diff options
Diffstat (limited to 'src/main')
6 files changed, 23 insertions, 24 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; } } diff --git a/src/main/resources/assets/libgui/textures/widget/widgets.png b/src/main/resources/assets/libgui/textures/widget/widgets.png Binary files differnew file mode 100644 index 0000000..bbdbaa4 --- /dev/null +++ b/src/main/resources/assets/libgui/textures/widget/widgets.png diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 9a59c86..0cee58e 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -25,14 +25,14 @@ "mixins": ["mixins.libgui.json"], "depends": { "java": ">=17", - "fabricloader": ">=0.14.21", - "fabric-api-base": ">=0.4.4", - "fabric-lifecycle-events-v1": "^2.0.2", - "fabric-networking-api-v1": "^1.0.21", - "fabric-rendering-v1": "^3.0.6", - "minecraft": ">=1.20-rc.1", - "jankson": "^6.0.0", - "libninepatch": "^1.2.0" + "fabricloader": ">=${loader_version}", + "fabric-api-base": ">=${fabric_api_base_version}", + "fabric-lifecycle-events-v1": "^${fabric_lifecycle_events_v1_version}", + "fabric-networking-api-v1": "^${fabric_networking_api_v1_version}", + "fabric-rendering-v1": "^${fabric_rendering_v1_version}", + "minecraft": ">=${minecraft_version}", + "jankson": "^${jankson_version}", + "libninepatch": "^${libninepatch_version}" }, "suggests": { "flamingo": "*" |