diff options
author | nea <nea@nea.moe> | 2023-09-25 18:22:20 +0200 |
---|---|---|
committer | nea <nea@nea.moe> | 2023-09-25 18:22:20 +0200 |
commit | 4857461afbddc6a4e5bbe66e80efe8072b273dd9 (patch) | |
tree | c0c0a510496af56c2a1f66c716229fbac4954038 /src/main/java/io | |
parent | cc01e089d361f56382eb43560aee952674211dd2 (diff) | |
download | LibGui-1.20.2.tar.gz LibGui-1.20.2.tar.bz2 LibGui-1.20.2.zip |
Add 1.20.2 support1.20.2
Diffstat (limited to 'src/main/java/io')
4 files changed, 15 insertions, 16 deletions
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java index 64d905e..4f117af 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java @@ -158,7 +158,7 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio } if (slotStack.isEmpty()) { - slot.setStack(ItemStack.EMPTY); + slot.setStackNoCallbacks(ItemStack.EMPTY); } else { slot.markDirty(); } @@ -193,9 +193,9 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio ItemStack curSlotStack = slot.getStack(); if (curSlotStack.isEmpty() && slot.canInsert(toInsert)) { if (toInsert.getCount() > slot.getMaxItemCount(toInsert)) { - slot.setStack(toInsert.split(slot.getMaxItemCount(toInsert))); + slot.setStackNoCallbacks(toInsert.split(slot.getMaxItemCount(toInsert))); } else { - slot.setStack(toInsert.split(toInsert.getCount())); + slot.setStackNoCallbacks(toInsert.split(toInsert.getCount())); } slot.markDirty(); diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java index 877528c..9c5c5d1 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java @@ -124,7 +124,7 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl { } private void paint(DrawContext context, int mouseX, int mouseY) { - renderBackground(context); + renderBackground(context, mouseX, mouseY, client.getTickDelta()); if (description!=null) { WPanel root = description.getRootPanel(); @@ -146,9 +146,7 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl { @Override public void render(DrawContext context, int mouseX, int mouseY, float partialTicks) { paint(context, mouseX, mouseY); - - super.render(context, mouseX, mouseY, partialTicks); - + if (description!=null) { WPanel root = description.getRootPanel(); if (root!=null) { @@ -207,12 +205,12 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl { } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double amount) { - super.mouseScrolled(mouseX, mouseY, amount); + public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { + super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); int containerX = (int)mouseX-left; int containerY = (int)mouseY-top; - mouseInputHandler.onMouseScroll(containerX, containerY, amount); + mouseInputHandler.onMouseScroll(containerX, containerY, horizontalAmount); return true; } diff --git a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java index b1ed4ce..9e321eb 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java @@ -223,12 +223,12 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl } @Override - public boolean mouseScrolled(double mouseX, double mouseY, double amount) { - super.mouseScrolled(mouseX, mouseY, amount); + public boolean mouseScrolled(double mouseX, double mouseY, double horizontalAmount, double verticalAmount) { + super.mouseScrolled(mouseX, mouseY, horizontalAmount, verticalAmount); int containerX = (int)mouseX-x; int containerY = (int)mouseY-y; - mouseInputHandler.onMouseScroll(containerX, containerY, amount); + mouseInputHandler.onMouseScroll(containerX, containerY, horizontalAmount); return true; } @@ -276,8 +276,8 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl protected void drawBackground(DrawContext context, float partialTicks, int mouseX, int mouseY) {} //This is just an AbstractContainerScreen thing; most Screens don't work this way. private void paint(DrawContext context, int mouseX, int mouseY) { - renderBackground(context); - + renderBackground(context, mouseX, mouseY, client.getTickDelta()); + if (description!=null) { WPanel root = description.getRootPanel(); if (root!=null) { diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java index 1230905..f456fec 100644 --- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java +++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java @@ -21,6 +21,7 @@ import org.jetbrains.annotations.Nullable; public class WButton extends WWidget { private static final Identifier DARK_WIDGETS_LOCATION = new Identifier("libgui", "textures/widget/dark_widgets.png"); + private static final Identifier BRIGHT_WIDGETS_LOCATION = new Identifier("libgui", "textures/widget/widgets.png"); private static final int BUTTON_HEIGHT = 20; private static final int ICON_SPACING = 2; @@ -269,6 +270,6 @@ public class WButton extends WWidget { @Environment(EnvType.CLIENT) static Identifier getTexture(WWidget widget) { - return widget.shouldRenderInDarkMode() ? DARK_WIDGETS_LOCATION : ClickableWidget.WIDGETS_TEXTURE; + return widget.shouldRenderInDarkMode() ? DARK_WIDGETS_LOCATION : BRIGHT_WIDGETS_LOCATION; } } |