From 127d08aee355a77085724d73543c53921e1d64d1 Mon Sep 17 00:00:00 2001 From: trychen Date: Fri, 7 Feb 2020 13:22:26 +0800 Subject: [PATCH] Release 1.13.7 & Fix HorizontalScrolling & Remove useless annotation --- gradle.properties | 2 +- .../java/cn/mccraft/pangu/core/PanguCore.java | 2 +- .../mccraft/pangu/core/client/ui/Button.java | 22 ++++------- .../pangu/core/client/ui/Container.java | 7 ++++ .../pangu/core/client/ui/TextField.java | 1 - .../ui/builtin/HorizontalScrolling.java | 2 +- .../pangu/core/network/KeyBasedMessage.java | 39 ------------------- 7 files changed, 18 insertions(+), 57 deletions(-) delete mode 100644 src/main/java/cn/mccraft/pangu/core/network/KeyBasedMessage.java diff --git a/gradle.properties b/gradle.properties index 1bcbf0a..d903eb3 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx3G # Mod Properties mod_id = Pangu -mod_version = 1.13.4 +mod_version = 1.13.7 mod_group = cn.mccraft.pangu mod_core_plugin = cn.mccraft.pangu.core.asm.PanguPlugin diff --git a/src/main/java/cn/mccraft/pangu/core/PanguCore.java b/src/main/java/cn/mccraft/pangu/core/PanguCore.java index 011d3a1..2421a7e 100644 --- a/src/main/java/cn/mccraft/pangu/core/PanguCore.java +++ b/src/main/java/cn/mccraft/pangu/core/PanguCore.java @@ -19,7 +19,7 @@ @Mod( modid = PanguCore.ID, name = "Pangu Core", - version = "1.13.4", + version = "1.13.7", useMetadata = true, acceptedMinecraftVersions = "[1.12.2,1.13)" ) diff --git a/src/main/java/cn/mccraft/pangu/core/client/ui/Button.java b/src/main/java/cn/mccraft/pangu/core/client/ui/Button.java index fcb30a2..e978aab 100644 --- a/src/main/java/cn/mccraft/pangu/core/client/ui/Button.java +++ b/src/main/java/cn/mccraft/pangu/core/client/ui/Button.java @@ -1,9 +1,6 @@ package cn.mccraft.pangu.core.client.ui; -import lombok.Data; -import lombok.Getter; -import lombok.NonNull; -import lombok.Setter; +import lombok.*; import lombok.experimental.Accessors; import java.util.function.Consumer; @@ -32,17 +29,17 @@ public abstract class Button extends Component { @Getter protected Consumer buttonClickEvent; - @Deprecated - public Button(int width, int height) { - super(); - setSize(width, height); - } public Button(float width, float height) { super(); setSize(width, height); } + @Deprecated + public Button(int width, int height) { + this((float) width, height); + } + public void onClick(int mouseButton, int mouseX, int mouseY) { if (isDisabled()) return; if (isPlayPressSound()) playPressSound(); @@ -91,10 +88,7 @@ public Button onButtonClick(Consumer consumer) { @Data public static class ButtonClickEvent { - @NonNull - private Button button; - - @NonNull - private int mouseButton, mouseX, mouseY; + private final Button button; + private final int mouseButton, mouseX, mouseY; } } diff --git a/src/main/java/cn/mccraft/pangu/core/client/ui/Container.java b/src/main/java/cn/mccraft/pangu/core/client/ui/Container.java index fc62574..70ef9d8 100644 --- a/src/main/java/cn/mccraft/pangu/core/client/ui/Container.java +++ b/src/main/java/cn/mccraft/pangu/core/client/ui/Container.java @@ -245,4 +245,11 @@ public void drawBackground() { public void drawForeground() { } + + @Override + public Container setScreen(Screen screen) { + for (Component component : components) component.setScreen(screen); + super.setScreen(screen); + return this; + } } \ No newline at end of file diff --git a/src/main/java/cn/mccraft/pangu/core/client/ui/TextField.java b/src/main/java/cn/mccraft/pangu/core/client/ui/TextField.java index b07e4d3..fe4380d 100644 --- a/src/main/java/cn/mccraft/pangu/core/client/ui/TextField.java +++ b/src/main/java/cn/mccraft/pangu/core/client/ui/TextField.java @@ -44,7 +44,6 @@ public class TextField extends Component implements Focusable { protected int lineScrollOffset; @Getter - @Setter protected int cursorPosition; @Getter diff --git a/src/main/java/cn/mccraft/pangu/core/client/ui/builtin/HorizontalScrolling.java b/src/main/java/cn/mccraft/pangu/core/client/ui/builtin/HorizontalScrolling.java index fef96ce..a273773 100644 --- a/src/main/java/cn/mccraft/pangu/core/client/ui/builtin/HorizontalScrolling.java +++ b/src/main/java/cn/mccraft/pangu/core/client/ui/builtin/HorizontalScrolling.java @@ -197,7 +197,7 @@ private void applyScrollLimits() { } public float getMaxScroll() { - return this.getContentHeight() - getHeight(); + return this.getContentWidth() - getWidth(); } @Override diff --git a/src/main/java/cn/mccraft/pangu/core/network/KeyBasedMessage.java b/src/main/java/cn/mccraft/pangu/core/network/KeyBasedMessage.java deleted file mode 100644 index 0b79833..0000000 --- a/src/main/java/cn/mccraft/pangu/core/network/KeyBasedMessage.java +++ /dev/null @@ -1,39 +0,0 @@ -package cn.mccraft.pangu.core.network; - -import cn.mccraft.pangu.core.loader.Load; -import com.trychen.bytedatastream.ByteSerialization; -import io.netty.buffer.ByteBuf; -import lombok.Data; -import lombok.NonNull; -import net.minecraftforge.fml.common.network.ByteBufUtils; - -import java.io.IOException; - -@Data -@Deprecated -public class KeyBasedMessage extends ByteMessage { - - @NonNull - private String key; - - public KeyBasedMessage(@NonNull String key, byte[] bytes) { - super(bytes); - this.key = key; - } - - @Override - public void fromBytes(ByteBuf buf) { - key = ByteBufUtils.readUTF8String(buf); - super.fromBytes(buf); - } - - @Override - public void toBytes(ByteBuf buf) { - try { - buf.writeBytes(ByteSerialization.serialize(key)); - } catch (IOException e) { - e.printStackTrace(); - } - super.toBytes(buf); - } -}