aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuuz <6596629+Juuxel@users.noreply.github.com>2022-12-11 14:12:49 +0200
committerJuuz <6596629+Juuxel@users.noreply.github.com>2022-12-11 14:12:49 +0200
commite0bcfebef37e727ccea046138b6c633c57056d96 (patch)
tree5e0b70af68bb073ce54dee874f0b72121aa6e92f
parent2aa6d47f648274137cd346115245c28a11ff1723 (diff)
downloadLibGui-e0bcfebef37e727ccea046138b6c633c57056d96.tar.gz
LibGui-e0bcfebef37e727ccea046138b6c633c57056d96.tar.bz2
LibGui-e0bcfebef37e727ccea046138b6c633c57056d96.zip
Update to Minecraft 1.19.3, part 2
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java8
-rw-r--r--GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java22
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java2
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonClientScreen.java4
-rw-r--r--src/main/java/io/github/cottonmc/cotton/gui/client/CottonInventoryScreen.java4
5 files changed, 18 insertions, 22 deletions
diff --git a/GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java b/GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java
index 278ddb9..d629b68 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/GuiItem.java
@@ -1,13 +1,10 @@
package io.github.cottonmc.test;
-import io.github.cottonmc.cotton.gui.client.CottonClientScreen;
-import io.github.cottonmc.test.client.TestClientGui;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.minecraft.client.MinecraftClient;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemGroup;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ActionResult;
import net.minecraft.util.Hand;
@@ -15,10 +12,13 @@ import net.minecraft.util.Rarity;
import net.minecraft.util.TypedActionResult;
import net.minecraft.world.World;
+import io.github.cottonmc.cotton.gui.client.CottonClientScreen;
+import io.github.cottonmc.test.client.TestClientGui;
+
public class GuiItem extends Item {
public GuiItem() {
- super(new Item.Settings().group(ItemGroup.TOOLS).rarity(Rarity.EPIC));
+ super(new Item.Settings().rarity(Rarity.EPIC));
}
@Override
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 8a3fe4b..009ea23 100644
--- a/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
+++ b/GuiTest/src/main/java/io/github/cottonmc/test/LibGuiTest.java
@@ -11,11 +11,11 @@ import net.minecraft.block.entity.BlockEntityType;
import net.minecraft.entity.player.PlayerInventory;
import net.minecraft.item.BlockItem;
import net.minecraft.item.Item;
-import net.minecraft.item.ItemGroup;
+import net.minecraft.registry.Registries;
+import net.minecraft.registry.Registry;
import net.minecraft.screen.ScreenHandlerContext;
import net.minecraft.screen.ScreenHandlerType;
import net.minecraft.util.Identifier;
-import net.minecraft.util.registry.Registry;
import java.io.IOException;
import java.nio.file.Files;
@@ -34,25 +34,25 @@ public class LibGuiTest implements ModInitializer {
@Override
public void onInitialize() {
- Registry.register(Registry.ITEM, new Identifier(MODID, "client_gui"), new GuiItem());
+ Registry.register(Registries.ITEM, new Identifier(MODID, "client_gui"), new GuiItem());
GUI_BLOCK = new GuiBlock();
- Registry.register(Registry.BLOCK, new Identifier(MODID, "gui"), GUI_BLOCK);
- GUI_BLOCK_ITEM = new BlockItem(GUI_BLOCK, new Item.Settings().group(ItemGroup.MISC));
- Registry.register(Registry.ITEM, new Identifier(MODID, "gui"), GUI_BLOCK_ITEM);
+ Registry.register(Registries.BLOCK, new Identifier(MODID, "gui"), GUI_BLOCK);
+ GUI_BLOCK_ITEM = new BlockItem(GUI_BLOCK, new Item.Settings());
+ Registry.register(Registries.ITEM, new Identifier(MODID, "gui"), GUI_BLOCK_ITEM);
NO_BLOCK_INVENTORY_BLOCK = new NoBlockInventoryBlock(AbstractBlock.Settings.copy(Blocks.STONE));
- Registry.register(Registry.BLOCK, new Identifier(MODID, "no_block_inventory"), NO_BLOCK_INVENTORY_BLOCK);
- Registry.register(Registry.ITEM, new Identifier(MODID, "no_block_inventory"), new BlockItem(NO_BLOCK_INVENTORY_BLOCK, new Item.Settings().group(ItemGroup.MISC)));
+ Registry.register(Registries.BLOCK, new Identifier(MODID, "no_block_inventory"), NO_BLOCK_INVENTORY_BLOCK);
+ Registry.register(Registries.ITEM, new Identifier(MODID, "no_block_inventory"), new BlockItem(NO_BLOCK_INVENTORY_BLOCK, new Item.Settings()));
GUI_BLOCKENTITY_TYPE = FabricBlockEntityTypeBuilder.create(GuiBlockEntity::new, GUI_BLOCK).build(null);
- Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(MODID, "gui"), GUI_BLOCKENTITY_TYPE);
+ Registry.register(Registries.BLOCK_ENTITY_TYPE, new Identifier(MODID, "gui"), GUI_BLOCKENTITY_TYPE);
GUI_SCREEN_HANDLER_TYPE = new ScreenHandlerType<>((int syncId, PlayerInventory inventory) -> {
return new TestDescription(GUI_SCREEN_HANDLER_TYPE, syncId, inventory, ScreenHandlerContext.EMPTY);
});
- Registry.register(Registry.SCREEN_HANDLER, new Identifier(MODID, "gui"), GUI_SCREEN_HANDLER_TYPE);
+ Registry.register(Registries.SCREEN_HANDLER, new Identifier(MODID, "gui"), GUI_SCREEN_HANDLER_TYPE);
REALLY_SIMPLE_SCREEN_HANDLER_TYPE = new ScreenHandlerType<>(ReallySimpleDescription::new);
- Registry.register(Registry.SCREEN_HANDLER, new Identifier(MODID, "really_simple"), REALLY_SIMPLE_SCREEN_HANDLER_TYPE);
+ Registry.register(Registries.SCREEN_HANDLER, new Identifier(MODID, "really_simple"), REALLY_SIMPLE_SCREEN_HANDLER_TYPE);
Optional<ModContainer> containerOpt = FabricLoader.getInstance().getModContainer("jankson");
if (containerOpt.isPresent()) {
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 b56c9f8..15917ff 100644
--- a/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java
+++ b/src/main/java/io/github/cottonmc/cotton/gui/SyncedGuiDescription.java
@@ -134,7 +134,7 @@ public class SyncedGuiDescription extends ScreenHandler implements GuiDescriptio
}
@Override
- public ItemStack transferSlot(PlayerEntity player, int index) {
+ public ItemStack quickMove(PlayerEntity player, int index) {
ItemStack result = ItemStack.EMPTY;
Slot slot = slots.get(index);
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 4053360..524e73d 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
@@ -62,8 +62,7 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
@Override
public void init() {
super.init();
- client.keyboard.setRepeatEvents(true);
-
+
WPanel root = description.getRootPanel();
if (root != null) root.addPainters();
description.addPainters();
@@ -73,7 +72,6 @@ public class CottonClientScreen extends Screen implements CottonScreenImpl {
@Override
public void removed() {
super.removed();
- this.client.keyboard.setRepeatEvents(false);
VisualLogger.reset();
}
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 74fec98..6406619 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
@@ -96,8 +96,7 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
@Override
public void init() {
super.init();
- client.keyboard.setRepeatEvents(true);
-
+
WPanel root = description.getRootPanel();
if (root != null) root.addPainters();
description.addPainters();
@@ -108,7 +107,6 @@ public class CottonInventoryScreen<T extends SyncedGuiDescription> extends Handl
@Override
public void removed() {
super.removed();
- this.client.keyboard.setRepeatEvents(false);
VisualLogger.reset();
}