aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFalkreon <falkreon@gmail.com>2019-08-30 11:15:10 -0500
committerFalkreon <falkreon@gmail.com>2019-08-30 11:15:10 -0500
commit3f01c837c12ee1c20d2ff568393a005226a1c940 (patch)
tree8e903f86bf35634e608bd4ad147a322585af27bc
parentab75b7dafdcd147905f3d87c1e9c995aef39027c (diff)
downloadLibGui-3f01c837c12ee1c20d2ff568393a005226a1c940.tar.gz
LibGui-3f01c837c12ee1c20d2ff568393a005226a1c940.tar.bz2
LibGui-3f01c837c12ee1c20d2ff568393a005226a1c940.zip
CottonScreenController -> CottonCraftingController, hit coordinates fix
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/TestContainer.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/CottonCraftingController.java (renamed from src/main/java/io/github/cottonmc/cotton/gui/CottonScreenController.java)10
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java6
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java2
4 files changed, 11 insertions, 11 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/TestContainer.java b/GuiTest/src/main/java/io/github/cottonmc/test/TestContainer.java
index 975cd6f..b4bb11b 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/TestContainer.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/TestContainer.java
@@ -1,6 +1,6 @@
package io.github.cottonmc.test;
-import io.github.cottonmc.cotton.gui.CottonScreenController;
+import io.github.cottonmc.cotton.gui.CottonCraftingController;
import io.github.cottonmc.cotton.gui.widget.WButton;
import io.github.cottonmc.cotton.gui.widget.WGridPanel;
import io.github.cottonmc.cotton.gui.widget.WItemSlot;
@@ -9,7 +9,7 @@ import net.minecraft.container.BlockContext;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.text.LiteralText;
-public class TestContainer extends CottonScreenController {
+public class TestContainer extends CottonCraftingController {
public TestContainer(int syncId, PlayerInventory playerInventory, BlockContext context) {
super(null, syncId, playerInventory, getBlockInventory(context), null);
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/CottonScreenController.java b/src/main/java/io/github/cottonmc/cotton/gui/CottonCraftingController.java
index 0e95295..2b9edc2 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/CottonScreenController.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/CottonCraftingController.java
@@ -29,7 +29,7 @@ import net.minecraft.recipe.RecipeInputProvider;
import net.minecraft.recipe.RecipeType;
import net.minecraft.world.World;
-public class CottonScreenController extends CraftingContainer<Inventory> implements GuiDescription {
+public class CottonCraftingController extends CraftingContainer<Inventory> implements GuiDescription {
protected Inventory blockInventory;
protected PlayerInventory playerInventory;
@@ -43,7 +43,7 @@ public class CottonScreenController extends CraftingContainer<Inventory> impleme
protected WWidget focus;
- public CottonScreenController(RecipeType<?> recipeType, int syncId, PlayerInventory playerInventory) {
+ public CottonCraftingController(RecipeType<?> recipeType, int syncId, PlayerInventory playerInventory) {
super(null, syncId);
this.blockInventory = null;
this.playerInventory = playerInventory;
@@ -52,7 +52,7 @@ public class CottonScreenController extends CraftingContainer<Inventory> impleme
this.propertyDelegate = null;//new ArrayPropertyDelegate(1);
}
- public CottonScreenController(RecipeType<?> recipeType, int syncId, PlayerInventory playerInventory, Inventory blockInventory, PropertyDelegate propertyDelegate) {
+ public CottonCraftingController(RecipeType<?> recipeType, int syncId, PlayerInventory playerInventory, Inventory blockInventory, PropertyDelegate propertyDelegate) {
super(null, syncId);
this.blockInventory = blockInventory;
this.playerInventory = playerInventory;
@@ -70,12 +70,12 @@ public class CottonScreenController extends CraftingContainer<Inventory> impleme
return LibGuiClient.config.darkMode ? darkTitleColor : titleColor;
}
- public CottonScreenController setRootPanel(WPanel panel) {
+ public CottonCraftingController setRootPanel(WPanel panel) {
this.rootPanel = panel;
return this;
}
- public CottonScreenController setTitleColor(int color) {
+ public CottonCraftingController setTitleColor(int color) {
this.titleColor = color;
return this;
}
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 0be2ecd..b7acb28 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
@@ -1,6 +1,6 @@
package io.github.cottonmc.cotton.gui.client;
-import io.github.cottonmc.cotton.gui.CottonScreenController;
+import io.github.cottonmc.cotton.gui.CottonCraftingController;
import io.github.cottonmc.cotton.gui.widget.WPanel;
import io.github.cottonmc.cotton.gui.widget.WWidget;
import net.minecraft.client.MinecraftClient;
@@ -10,8 +10,8 @@ import net.minecraft.text.LiteralText;
import net.minecraft.text.Text;
import net.minecraft.util.Nameable;
-public class CottonInventoryScreen<T extends CottonScreenController> extends AbstractContainerScreen<T> {
- protected CottonScreenController container;
+public class CottonInventoryScreen<T extends CottonCraftingController> extends AbstractContainerScreen<T> {
+ protected CottonCraftingController container;
public static final int PADDING = 8;
protected WWidget lastResponder = null;
protected WWidget focus = null;
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
index cda638d..960a6e6 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/widget/WPanel.java
@@ -131,7 +131,7 @@ public abstract class WPanel extends WWidget {
y>=child.getY() &&
x<child.getX()+child.getWidth() &&
y<child.getY()+child.getHeight()) {
- return child.hit(x, y);
+ return child.hit(x-child.getX(), y-child.getY());
}
}
return this;