Skip to content

Commit

Permalink
fix: fix buggy Vial Holder block breaking
Browse files Browse the repository at this point in the history
  • Loading branch information
Elenterius committed Aug 14, 2023
1 parent 7a8bd97 commit 5f343e0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ else if (v > min) {
public void onRemove(BlockState state, Level level, BlockPos pos, BlockState newState, boolean isMoving) {
if (!state.is(newState.getBlock())) {
if (level.getBlockEntity(pos) instanceof VialHolderBlockEntity vialHolder) {
vialHolder.dropInventoryContents(level, pos);
vialHolder.dropInventoryContents(level, pos, true);
}
super.onRemove(state, level, pos, newState, isMoving);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,10 @@ protected void saveForSyncToClient(CompoundTag tag) {
tag.put(INVENTORY_TAG, inventory.serializeNBT());
}

public void dropInventoryContents(Level level, BlockPos pos) {
public void dropInventoryContents(Level level, BlockPos pos, boolean removeWithoutUpdate) {
for (int i = 0; i < inventory.getSlots(); i++) {
ItemStack stack = inventory.extractItem(i, inventory.getSlotLimit(i), false);
ItemStack stack = inventory.extractItem(i, inventory.getSlotLimit(i), removeWithoutUpdate);
if (stack.isEmpty()) continue;

Containers.dropItemStack(level, pos.getX(), pos.getY(), pos.getZ(), stack);
}
}
Expand Down

0 comments on commit 5f343e0

Please sign in to comment.