aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornea <nea@nea.moe>2023-09-25 18:22:20 +0200
committernea <nea@nea.moe>2023-09-25 18:22:20 +0200
commit4857461afbddc6a4e5bbe66e80efe8072b273dd9 (patch)
treec0c0a510496af56c2a1f66c716229fbac4954038
parentcc01e089d361f56382eb43560aee952674211dd2 (diff)
downloadLibGui-4857461afbddc6a4e5bbe66e80efe8072b273dd9.tar.gz
LibGui-4857461afbddc6a4e5bbe66e80efe8072b273dd9.tar.bz2
LibGui-4857461afbddc6a4e5bbe66e80efe8072b273dd9.zip
Add 1.20.2 support1.20.2
-rw-r--r--build.gradle23
-rw-r--r--gradle.properties12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java12
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java10
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WButton.java3
-rw-r--r--src/main/resources/assets/libgui/textures/widget/widgets.pngbin0 -> 10837 bytes
-rw-r--r--src/main/resources/fabric.mod.json16
8 files changed, 44 insertions, 38 deletions
diff --git a/build.gradle b/build.gradle
index 0234a4d..9bd28b7 100644
--- a/build.gradle
+++ b/build.gradle
@@ -64,19 +64,19 @@ repositories {
}
}
}
+// True: module classes are used in public API classes/methods/fields
+def fabricApiModules = [
+ 'fabric-api-base': true,
+ 'fabric-lifecycle-events-v1': false,
+ 'fabric-networking-api-v1': true,
+ 'fabric-rendering-v1': false,
+]
dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings "net.fabricmc:yarn:${project.yarn_mappings}:v2"
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
- // True: module classes are used in public API classes/methods/fields
- def fabricApiModules = [
- 'fabric-api-base': true,
- 'fabric-lifecycle-events-v1': false,
- 'fabric-networking-api-v1': true,
- 'fabric-rendering-v1': false,
- ]
fabricApiModules.forEach { module, api ->
def dependency = fabricApi.module(module, project.fabric_version)
@@ -108,9 +108,16 @@ dependencies {
processResources {
inputs.property "version", project.version
+ inputs.property "loader_version", project.loader_version
+ fabricApiModules.forEach {module, api ->
+ inputs.property "${module.replace("-", "_")}_version", fabricApi.moduleVersion(module, project.fabric_version)
+ }
+ inputs.property "minecraft_version", project.minecraft_version
+ inputs.property "jankson_version", project.jankson_version.split("\\+")[0]
+ inputs.property "libninepatch_version", project.libninepatch_version
filesMatching("fabric.mod.json") {
- expand "version": project.version
+ expand inputs.properties
}
}
diff --git a/gradle.properties b/gradle.properties
index 949a79a..da33e41 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -3,17 +3,17 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/develop
- minecraft_version=1.20.1
- yarn_mappings=1.20.1+build.10
- loader_version=0.14.21
+ minecraft_version=1.20.2
+ yarn_mappings=1.20.2+build.1
+ loader_version=0.14.22
# Mod Properties
- mod_version = 8.0.2
+ mod_version = 8.1.0
maven_group = io.github.cottonmc
archives_base_name = LibGui
# Dependencies
- fabric_version=0.86.1+1.20.1
+ fabric_version=0.89.2+1.20.2
jankson_version=6.0.0+j1.2.3
- modmenu_version=7.0.1
+ modmenu_version=7.2.2
libninepatch_version=1.2.0
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
new file mode 100644
index 0000000..bbdbaa4
--- /dev/null
+++ b/src/main/resources/assets/libgui/textures/widget/widgets.png
Binary files differ
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": "*"