aboutsummaryrefslogtreecommitdiff
path: root/GuiTest
diff options
context:
space:
mode:
authorJuuxel <6596629+Juuxel@users.noreply.github.com>2020-05-09 14:01:58 +0300
committerGitHub <noreply@github.com>2020-05-09 14:01:58 +0300
commitb3d673df2fa83bc092ec2ba37eb936a4255b1b59 (patch)
tree4bbf521a83d1564c6179a2d5343dce6d719e6286 /GuiTest
parent9743d57ec08b0488e2c7152615d54dd813a1bd3f (diff)
parent0060aa9e7db6c26d031c2bfb7f5acfa00378b349 (diff)
downloadLibGui-b3d673df2fa83bc092ec2ba37eb936a4255b1b59.tar.gz
LibGui-b3d673df2fa83bc092ec2ba37eb936a4255b1b59.tar.bz2
LibGui-b3d673df2fa83bc092ec2ba37eb936a4255b1b59.zip
Merge pull request #40 from Juuxel/new-breaking
1.16 breaking changes
Diffstat (limited to 'GuiTest')
-rw-r--r--GuiTest/build.gradle2
-rw-r--r--GuiTest/gradle.properties10
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java4
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/ImplementedInventory.java32
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java6
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/TestController.java (renamed from GuiTest/src/main/java/io/github/cottonmc/test/TestContainer.java)10
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/LibGuiTestClient.java6
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java10
8 files changed, 40 insertions, 40 deletions
diff --git a/GuiTest/build.gradle b/GuiTest/build.gradle
index 849cf3e..9609abd 100644
--- a/GuiTest/build.gradle
+++ b/GuiTest/build.gradle
@@ -5,7 +5,7 @@ buildscript {
}
plugins {
- id 'fabric-loom' version '0.2.5-SNAPSHOT'
+ id 'fabric-loom' version '0.2.7-SNAPSHOT'
}
sourceCompatibility = JavaVersion.VERSION_1_8
diff --git a/GuiTest/gradle.properties b/GuiTest/gradle.properties
index 1ef1e05..b1db372 100644
--- a/GuiTest/gradle.properties
+++ b/GuiTest/gradle.properties
@@ -3,15 +3,15 @@ org.gradle.jvmargs=-Xmx1G
# Fabric Properties
# check these on https://fabricmc.net/use
- minecraft_version=1.15.2
- yarn_mappings=1.15.2+build.2
- loader_version=0.7.5+build.178
+ minecraft_version=20w17a
+ yarn_mappings=20w17a+build.4
+ loader_version=0.8.2+build.194
# Mod Properties
- mod_version = 1.5.1
+ mod_version = 1.9.0
maven_group = io.github.cottonmc
archives_base_name = LibGui
# Dependencies
- fabric_version=0.4.29+build.290-1.15
+ fabric_version=0.6.2+build.327-1.16
jankson_version=2.0.1+j1.2.0
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java b/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java
index f07ccb7..3e76fdd 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/GuiBlockEntity.java
@@ -3,7 +3,7 @@ package io.github.cottonmc.test;
import net.minecraft.block.entity.BlockEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.ItemStack;
-import net.minecraft.util.DefaultedList;
+import net.minecraft.util.collection.DefaultedList;
public class GuiBlockEntity extends BlockEntity implements ImplementedInventory {
@@ -19,7 +19,7 @@ public class GuiBlockEntity extends BlockEntity implements ImplementedInventory
}
@Override
- public boolean canPlayerUseInv(PlayerEntity player) {
+ public boolean canPlayerUse(PlayerEntity player) {
return pos.isWithinDistance(player.getBlockPos(), 4.5);
}
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/ImplementedInventory.java b/GuiTest/src/main/java/io/github/cottonmc/test/ImplementedInventory.java
index 177affd..1335b64 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/ImplementedInventory.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/ImplementedInventory.java
@@ -6,7 +6,7 @@ import net.minecraft.inventory.Inventory;
import net.minecraft.inventory.SidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundTag;
-import net.minecraft.util.DefaultedList;
+import net.minecraft.util.collection.DefaultedList;
import net.minecraft.util.math.Direction;
import java.util.List;
@@ -64,7 +64,7 @@ public interface ImplementedInventory extends SidedInventory {
* @return the available slots
*/
@Override
- default int[] getInvAvailableSlots(Direction side) {
+ default int[] getAvailableSlots(Direction side) {
int[] result = new int[getItems().size()];
for (int i = 0; i < result.length; i++) {
result[i] = i;
@@ -84,7 +84,7 @@ public interface ImplementedInventory extends SidedInventory {
* @return true if the stack can be inserted
*/
@Override
- default boolean canInsertInvStack(int slot, ItemStack stack, Direction side) {
+ default boolean canInsert(int slot, ItemStack stack, Direction side) {
return true;
}
@@ -99,7 +99,7 @@ public interface ImplementedInventory extends SidedInventory {
* @return true if the stack can be extracted
*/
@Override
- default boolean canExtractInvStack(int slot, ItemStack stack, Direction side) {
+ default boolean canExtract(int slot, ItemStack stack, Direction side) {
return true;
}
@@ -113,7 +113,7 @@ public interface ImplementedInventory extends SidedInventory {
* @return the inventory size
*/
@Override
- default int getInvSize() {
+ default int size() {
return getItems().size();
}
@@ -121,9 +121,9 @@ public interface ImplementedInventory extends SidedInventory {
* @return true if this inventory has only empty stacks, false otherwise
*/
@Override
- default boolean isInvEmpty() {
- for (int i = 0; i < getInvSize(); i++) {
- ItemStack stack = getInvStack(i);
+ default boolean isEmpty() {
+ for (int i = 0; i < size(); i++) {
+ ItemStack stack = getStack(i);
if (!stack.isEmpty()) {
return false;
}
@@ -139,7 +139,7 @@ public interface ImplementedInventory extends SidedInventory {
* @return the item in the slot
*/
@Override
- default ItemStack getInvStack(int slot) {
+ default ItemStack getStack(int slot) {
return getItems().get(slot);
}
@@ -154,7 +154,7 @@ public interface ImplementedInventory extends SidedInventory {
* @return a stack
*/
@Override
- default ItemStack takeInvStack(int slot, int count) {
+ default ItemStack removeStack(int slot, int count) {
ItemStack result = Inventories.splitStack(getItems(), slot, count);
if (!result.isEmpty()) {
markDirty();
@@ -172,24 +172,24 @@ public interface ImplementedInventory extends SidedInventory {
* @return the removed stack
*/
@Override
- default ItemStack removeInvStack(int slot) {
+ default ItemStack removeStack(int slot) {
return Inventories.removeStack(getItems(), slot);
}
/**
* Replaces the current stack in the {@code slot} with the provided stack.
*
- * <p>If the stack is too big for this inventory ({@link Inventory#getInvMaxStackAmount()}),
+ * <p>If the stack is too big for this inventory ({@link Inventory#getMaxCountPerStack()} ()}),
* it gets resized to this inventory's maximum amount.
*
* @param slot the slot
* @param stack the stack
*/
@Override
- default void setInvStack(int slot, ItemStack stack) {
+ default void setStack(int slot, ItemStack stack) {
getItems().set(slot, stack);
- if (stack.getCount() > getInvMaxStackAmount()) {
- stack.setCount(getInvMaxStackAmount());
+ if (stack.getCount() > getMaxCountPerStack()) {
+ stack.setCount(getMaxCountPerStack());
}
}
@@ -207,7 +207,7 @@ public interface ImplementedInventory extends SidedInventory {
}
@Override
- default boolean canPlayerUseInv(PlayerEntity player) {
+ default boolean canPlayerUse(PlayerEntity player) {
return true;
}
} \ No newline at end of file
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 32d359d..6d63688 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
@@ -10,13 +10,13 @@ import net.fabricmc.fabric.api.container.ContainerProviderRegistry;
import net.fabricmc.loader.api.FabricLoader;
import net.fabricmc.loader.api.ModContainer;
import net.minecraft.block.entity.BlockEntityType;
-import net.minecraft.container.BlockContext;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
import net.minecraft.item.ItemGroup;
+import net.minecraft.network.PacketByteBuf;
+import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.util.Identifier;
-import net.minecraft.util.PacketByteBuf;
import net.minecraft.util.registry.Registry;
public class LibGuiTest implements ModInitializer {
@@ -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 TestContainer(syncId, player.inventory, BlockContext.create(player.getEntityWorld(), buf.readBlockPos()));
+ return new TestController(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/TestContainer.java b/GuiTest/src/main/java/io/github/cottonmc/test/TestController.java
index b4bb11b..43a0a6f 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/TestContainer.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/TestController.java
@@ -1,18 +1,18 @@
package io.github.cottonmc.test;
-import io.github.cottonmc.cotton.gui.CottonCraftingController;
+import io.github.cottonmc.cotton.gui.CottonInventoryController;
import io.github.cottonmc.cotton.gui.widget.WButton;
import io.github.cottonmc.cotton.gui.widget.WGridPanel;
import io.github.cottonmc.cotton.gui.widget.WItemSlot;
import io.github.cottonmc.cotton.gui.widget.WPlayerInvPanel;
-import net.minecraft.container.BlockContext;
import net.minecraft.entity.player.PlayerInventory;
+import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.text.LiteralText;
-public class TestContainer extends CottonCraftingController {
+public class TestController extends CottonInventoryController {
- public TestContainer(int syncId, PlayerInventory playerInventory, BlockContext context) {
- super(null, syncId, playerInventory, getBlockInventory(context), null);
+ public TestController(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 6db6902..a2a23fb 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,17 +2,17 @@ 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.TestContainer;
+import io.github.cottonmc.test.TestController;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.screen.ScreenProviderRegistry;
-import net.minecraft.container.BlockContext;
+import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.util.Identifier;
public class LibGuiTestClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
- ScreenProviderRegistry.INSTANCE.registerFactory(new Identifier(LibGuiTest.MODID, "gui"), (syncId, identifier, player, buf)->new CottonInventoryScreen<TestContainer>(new TestContainer(syncId, player.inventory, BlockContext.create(player.getEntityWorld(), buf.readBlockPos())), player));
+ 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));
}
}
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java b/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java
index e1e23d5..b96a359 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/client/TestClientGui.java
@@ -20,7 +20,9 @@ import io.github.cottonmc.cotton.gui.widget.data.Axis;
import io.github.cottonmc.cotton.gui.widget.data.Color;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
+import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.text.LiteralText;
+import net.minecraft.text.Text;
import net.minecraft.util.Identifier;
public class TestClientGui extends LightweightGuiDescription {
@@ -43,8 +45,8 @@ public class TestClientGui extends LightweightGuiDescription {
WLabel title = new WLabel(new LiteralText("Client Test Gui"), WLabel.DEFAULT_TEXT_COLOR) {
@Override
- public void addInformation(List<String> information) {
- information.add("Radical!");
+ public void addTooltip(List<Text> tooltip) {
+ tooltip.add(new LiteralText("Radical!"));
}
};
root.add(title, 0, 0);
@@ -142,9 +144,7 @@ public class TestClientGui extends LightweightGuiDescription {
}
@Override
- public void paintBackground(int x, int y, int mouseX, int mouseY) {
- super.paintBackground(x, y, mouseX, mouseY);
-
+ public void paint(MatrixStack matrices, int x, int y, int mouseX, int mouseY) {
ScreenDrawing.coloredRect(x, y, this.getWidth(), this.getHeight(), color);
}
}