From b9fbcd72ddb3cb43ff01f39ae12148e82204a22c Mon Sep 17 00:00:00 2001 From: William Date: Sat, 15 Jun 2024 13:55:38 +0100 Subject: [PATCH] fix/fabric: slightly adjust item applying --- .../java/net/william278/husksync/data/FabricData.java | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/fabric/src/main/java/net/william278/husksync/data/FabricData.java b/fabric/src/main/java/net/william278/husksync/data/FabricData.java index e282db48..77b6b466 100644 --- a/fabric/src/main/java/net/william278/husksync/data/FabricData.java +++ b/fabric/src/main/java/net/william278/husksync/data/FabricData.java @@ -153,13 +153,13 @@ public abstract class FabricData implements Data { @Override public int getSlotCount() { - return INVENTORY_SLOT_COUNT; + return getContents().length; } @Override public void apply(@NotNull FabricUser user, @NotNull FabricHuskSync plugin) throws IllegalStateException { final ServerPlayerEntity player = user.getPlayer(); - this.clearInventoryCraftingSlots(player); + player.playerScreenHandler.clearCraftingSlots(); player.currentScreenHandler.setCursorStack(ItemStack.EMPTY); final ItemStack[] items = getContents(); for (int slot = 0; slot < player.getInventory().size(); slot++) { @@ -172,10 +172,6 @@ public abstract class FabricData implements Data { player.getInventory().updateItems(); } - private void clearInventoryCraftingSlots(@NotNull ServerPlayerEntity player) { - player.playerScreenHandler.clearCraftingSlots(); - } - } public static class EnderChest extends FabricData.Items implements Data.Items.EnderChest {