From 4987f41b55438529eac61a7c9d986549e886467d Mon Sep 17 00:00:00 2001 From: BlayTheNinth <1933180+BlayTheNinth@users.noreply.github.com> Date: Tue, 21 May 2024 09:23:35 +0200 Subject: [PATCH] refactor: Some small 1.20.6 changes for consistency --- .../net/blay09/mods/balm/api/container/DefaultContainer.java | 4 ++-- .../blay09/mods/balm/api/container/ImplementedContainer.java | 2 +- .../java/net/blay09/mods/balm/api/menu/BalmMenuProvider.java | 2 +- .../blay09/mods/balm/forge/network/ForgeBalmNetworking.java | 2 +- .../mods/balm/neoforge/network/NeoForgeBalmNetworking.java | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/common/src/main/java/net/blay09/mods/balm/api/container/DefaultContainer.java b/common/src/main/java/net/blay09/mods/balm/api/container/DefaultContainer.java index 007a7002..54fb7f7c 100644 --- a/common/src/main/java/net/blay09/mods/balm/api/container/DefaultContainer.java +++ b/common/src/main/java/net/blay09/mods/balm/api/container/DefaultContainer.java @@ -25,8 +25,8 @@ public NonNullList getItems() { return items; } - public void deserialize(HolderLookup.Provider provider, CompoundTag tag) { - items = ImplementedContainer.deserializeInventory(provider, tag, items.size()); + public void deserialize(CompoundTag tag, HolderLookup.Provider provider) { + items = ImplementedContainer.deserializeInventory(tag, items.size(), provider); } public CompoundTag serialize(HolderLookup.Provider provider) { diff --git a/common/src/main/java/net/blay09/mods/balm/api/container/ImplementedContainer.java b/common/src/main/java/net/blay09/mods/balm/api/container/ImplementedContainer.java index f16209f5..e426b604 100644 --- a/common/src/main/java/net/blay09/mods/balm/api/container/ImplementedContainer.java +++ b/common/src/main/java/net/blay09/mods/balm/api/container/ImplementedContainer.java @@ -143,7 +143,7 @@ default boolean stillValid(Player player) { return true; } - static NonNullList deserializeInventory(HolderLookup.Provider provider, CompoundTag tag, int minimumSize) { + static NonNullList deserializeInventory(CompoundTag tag, int minimumSize, HolderLookup.Provider provider) { int size = Math.max(minimumSize, tag.contains("Size", Tag.TAG_INT) ? tag.getInt("Size") : minimumSize); NonNullList items = NonNullList.withSize(size, ItemStack.EMPTY); ListTag itemTags = tag.getList("Items", Tag.TAG_COMPOUND); diff --git a/common/src/main/java/net/blay09/mods/balm/api/menu/BalmMenuProvider.java b/common/src/main/java/net/blay09/mods/balm/api/menu/BalmMenuProvider.java index 0797c9bd..d101bfa7 100644 --- a/common/src/main/java/net/blay09/mods/balm/api/menu/BalmMenuProvider.java +++ b/common/src/main/java/net/blay09/mods/balm/api/menu/BalmMenuProvider.java @@ -7,5 +7,5 @@ public interface BalmMenuProvider extends MenuProvider { TPayload getScreenOpeningData(ServerPlayer player); - StreamCodec getCodec(); + StreamCodec getScreenStreamCodec(); } diff --git a/forge/src/main/java/net/blay09/mods/balm/forge/network/ForgeBalmNetworking.java b/forge/src/main/java/net/blay09/mods/balm/forge/network/ForgeBalmNetworking.java index c016791b..bd3cc95f 100644 --- a/forge/src/main/java/net/blay09/mods/balm/forge/network/ForgeBalmNetworking.java +++ b/forge/src/main/java/net/blay09/mods/balm/forge/network/ForgeBalmNetworking.java @@ -59,7 +59,7 @@ public void openGui(Player player, MenuProvider menuProvider) { } private void openGui(ServerPlayer player, BalmMenuProvider menuProvider) { - player.openMenu(menuProvider, buf -> menuProvider.getCodec().encode(buf, menuProvider.getScreenOpeningData(player))); + player.openMenu(menuProvider, buf -> menuProvider.getScreenStreamCodec().encode(buf, menuProvider.getScreenOpeningData(player))); } @Override diff --git a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/network/NeoForgeBalmNetworking.java b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/network/NeoForgeBalmNetworking.java index e1aa5ffa..9b2c94f0 100644 --- a/neoforge/src/main/java/net/blay09/mods/balm/neoforge/network/NeoForgeBalmNetworking.java +++ b/neoforge/src/main/java/net/blay09/mods/balm/neoforge/network/NeoForgeBalmNetworking.java @@ -122,7 +122,7 @@ public void openGui(Player player, MenuProvider menuProvider) { } private void openGui(ServerPlayer player, BalmMenuProvider menuProvider) { - player.openMenu(menuProvider, buf -> menuProvider.getCodec().encode(buf, menuProvider.getScreenOpeningData(player))); + player.openMenu(menuProvider, buf -> menuProvider.getScreenStreamCodec().encode(buf, menuProvider.getScreenOpeningData(player))); } @Override