aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-06-05 18:01:27 +0300
committerJuuxel <6596629+Juuxel@users.noreply.github.com>2020-06-05 18:01:27 +0300
commitffa5a02e44381983ffdbddad0debc4569c1a1994 (patch)
treeb86b0d9f6353e715a203fd8b237a6fb89d63cd29
parentd866f96541b03c80fbc417c5ab5e87d7189bb723 (diff)
downloadLibGui-ffa5a02e44381983ffdbddad0debc4569c1a1994.tar.gz
LibGui-ffa5a02e44381983ffdbddad0debc4569c1a1994.tar.bz2
LibGui-ffa5a02e44381983ffdbddad0debc4569c1a1994.zip
CottonInventoryController -> SyncedGuiDescription
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java2
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java (renamed from GuiTest/src/main/java/io/github/cottonmc/test/TestController.java)7
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/PropertyDelegateHolder.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java (renamed from src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java)10
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java10
7 files changed, 18 insertions, 19 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java b/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
index 6d63688..90f3c92 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
@@ -38,7 +38,7 @@ public class LibGuiTest implements ModInitializer {
ContainerProviderRegistry.INSTANCE.registerFactory(new Identifier(MODID, "gui"), (int syncId, Identifier identifier, PlayerEntity player, PacketByteBuf buf)->{
- return new TestController(syncId, player.inventory, ScreenHandlerContext.create(player.getEntityWorld(), buf.readBlockPos()));
+ return new TestDescription(syncId, player.inventory, ScreenHandlerContext.create(player.getEntityWorld(), buf.readBlockPos()));
});
Optional<ModContainer> containerOpt = FabricLoader.getInstance().getModContainer("jankson");
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/TestController.java b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
index 68905ef..3d5e48c 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/TestController.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/TestDescription.java
@@ -1,15 +1,14 @@
package io.github.cottonmc.test;
-import io.github.cottonmc.cotton.gui.CottonInventoryController;
+import io.github.cottonmc.cotton.gui.SyncedGuiDescription;
import io.github.cottonmc.cotton.gui.widget.*;
-import io.github.cottonmc.cotton.gui.widget.data.Axis;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.text.LiteralText;
-public class TestController extends CottonInventoryController {
+public class TestDescription extends SyncedGuiDescription {
- public TestController(int syncId, PlayerInventory playerInventory, ScreenHandlerContext context) {
+ public TestDescription(int syncId, PlayerInventory playerInventory, ScreenHandlerContext context) {
super(syncId, playerInventory, getBlockInventory(context), null);
WGridPanel root = (WGridPanel)this.getRootPanel();
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
index a2a23fb..f0d3f27 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java
@@ -2,7 +2,7 @@ package io.github.cottonmc.test.client;
import io.github.cottonmc.cotton.gui.client.CottonInventoryScreen;
import io.github.cottonmc.test.LibGuiTest;
-import io.github.cottonmc.test.TestController;
+import io.github.cottonmc.test.TestDescription;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry;
import net.minecraft.screen.ScreenHandlerContext;
@@ -12,7 +12,7 @@ public class LibGuiTestClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
- ScreenProviderRegistry.INSTANCE.registerFactory(new Identifier(LibGuiTest.MODID, "gui"), (syncId, identifier, player, buf)->new CottonInventoryScreen<TestController>(new TestController(syncId, player.inventory, ScreenHandlerContext.create(player.getEntityWorld(), buf.readBlockPos())), player));
+ ScreenProviderRegistry.INSTANCE.registerFactory(new Identifier(LibGuiTest.MODID, "gui"), (syncId, identifier, player, buf)->new CottonInventoryScreen<TestDescription>(new TestDescription(syncId, player.inventory, ScreenHandlerContext.create(player.getEntityWorld(), buf.readBlockPos())), player));
}
}
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java b/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java
index 815b179..0c31912 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/GuiDescription.java
@@ -16,7 +16,7 @@ import net.minecraft.screen.PropertyDelegate;
* They also manage the focused widget.
*
* @see io.github.cottonmc.cotton.gui.client.LightweightGuiDescription
- * @see CottonInventoryController
+ * @see SyncedGuiDescription
*/
public interface GuiDescription {
public WPanel getRootPanel();
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/PropertyDelegateHolder.java b/src/main/java/io/github/cottonmc/cotton/gui/PropertyDelegateHolder.java
index af61892..6aa46bd 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/PropertyDelegateHolder.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/PropertyDelegateHolder.java
@@ -6,7 +6,7 @@ import net.minecraft.screen.PropertyDelegate;
* This interface can be implemented on block entity classes
* for providing a property delegate.
*
- * @see CottonInventoryController#getBlockPropertyDelegate(net.minecraft.screen.ScreenHandlerContext)
+ * @see SyncedGuiDescription#getBlockPropertyDelegate(net.minecraft.screen.ScreenHandlerContext)
*/
public interface PropertyDelegateHolder {
/**
diff --git a/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java
index 219f576..5f2bef0 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/CottonInventoryController.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java
@@ -25,7 +25,7 @@ import net.minecraft.world.World;
/**
* A screen handler-based GUI description for GUIs with slots.
*/
-public class CottonInventoryController extends ScreenHandler implements GuiDescription {
+public class SyncedGuiDescription extends ScreenHandler implements GuiDescription {
protected Inventory blockInventory;
protected PlayerInventory playerInventory;
@@ -38,7 +38,7 @@ public class CottonInventoryController extends ScreenHandler implements GuiDescr
protected WWidget focus;
- public CottonInventoryController(int syncId, PlayerInventory playerInventory) {
+ public SyncedGuiDescription(int syncId, PlayerInventory playerInventory) {
super(null, syncId);
this.blockInventory = null;
this.playerInventory = playerInventory;
@@ -46,7 +46,7 @@ public class CottonInventoryController extends ScreenHandler implements GuiDescr
this.propertyDelegate = null;//new ArrayPropertyDelegate(1);
}
- public CottonInventoryController(int syncId, PlayerInventory playerInventory, Inventory blockInventory, PropertyDelegate propertyDelegate) {
+ public SyncedGuiDescription(int syncId, PlayerInventory playerInventory, Inventory blockInventory, PropertyDelegate propertyDelegate) {
super(null, syncId);
this.blockInventory = blockInventory;
this.playerInventory = playerInventory;
@@ -63,12 +63,12 @@ public class CottonInventoryController extends ScreenHandler implements GuiDescr
return LibGuiClient.config.darkMode ? darkTitleColor : titleColor;
}
- public CottonInventoryController setRootPanel(WPanel panel) {
+ public SyncedGuiDescription setRootPanel(WPanel panel) {
this.rootPanel = panel;
return this;
}
- public CottonInventoryController setTitleColor(int color) {
+ public SyncedGuiDescription 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 5744aba..10ff4f6 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,5 +1,6 @@
package io.github.cottonmc.cotton.gui.client;
+import io.github.cottonmc.cotton.gui.SyncedGuiDescription;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.ingame.HandledScreen;
import net.minecraft.client.render.DiffuseLighting;
@@ -10,17 +11,16 @@ import net.minecraft.text.Style;
import net.minecraft.text.Text;
import org.lwjgl.glfw.GLFW;
-import io.github.cottonmc.cotton.gui.CottonInventoryController;
import io.github.cottonmc.cotton.gui.widget.WPanel;
import io.github.cottonmc.cotton.gui.widget.WWidget;
/**
- * A screen for a {@link CottonInventoryController}.
+ * A screen for a {@link SyncedGuiDescription}.
*
- * @param <T> the controller type
+ * @param <T> the description type
*/
-public class CottonInventoryScreen<T extends CottonInventoryController> extends HandledScreen<T> implements TextHoverRendererScreen {
- protected CottonInventoryController description;
+public class CottonInventoryScreen<T extends SyncedGuiDescription> extends HandledScreen<T> implements TextHoverRendererScreen {
+ protected SyncedGuiDescription description;
protected WWidget lastResponder = null;
/**