From 806a9ff75ab6aa1e6cb70cce602c7d999b03352f Mon Sep 17 00:00:00 2001 From: Maxx <53229958+MBatt1@users.noreply.github.com> Date: Sat, 23 Mar 2024 12:11:42 -0500 Subject: [PATCH] fix tree tap nbt --- .../blockentity/TreeTapBlockEntity.java | 29 ++++--------------- 1 file changed, 6 insertions(+), 23 deletions(-) diff --git a/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java b/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java index da44c6074..21809935b 100644 --- a/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java +++ b/src/main/java/net/id/paradiselost/blocks/blockentity/TreeTapBlockEntity.java @@ -57,7 +57,7 @@ public boolean canExtract(int slot, ItemStack stack, Direction dir) { @Override public @NotNull HopperStrategy getHopperStrategy() { - return HopperStrategy.IN_ANY_OUT_BOTTOM; + return HopperStrategy.IN_ANY; } @Override @@ -72,31 +72,17 @@ public void setStack(int slot, ItemStack stack) { stack.setCount(1); } inventoryChanged(); - System.out.println(getItems()); - } - - @Override - public ItemStack removeStack(int slot, int count) { - ItemStack stack = Inventories.splitStack(getItems(), slot, count); - inventoryChanged(); - return stack; - } - - @Override - public ItemStack removeStack(int slot) { - var stack = Inventories.removeStack(getItems(), slot); - inventoryChanged(); - return stack; } private void inventoryChanged() { - this.markDirty(); + markDirty(); if (world != null && !world.isClient) updateInClientWorld(); } @Override public void readNbt(NbtCompound nbt) { super.readNbt(nbt); + this.inventory.clear(); Inventories.readNbt(nbt, inventory); } @@ -122,12 +108,9 @@ public void tryCraft() { stack.decrement(1); // TODO: play a sound? - if (stack.isEmpty()) { - this.inventory.set(0, output); - updateInClientWorld(); - } else { - ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), output); - } + this.inventory.set(0, ItemStack.EMPTY); + inventoryChanged(); + ItemScatterer.spawn(world, pos.getX(), pos.getY(), pos.getZ(), output); } }