Skip to content

Commit

Permalink
Fix missing drops when breaking Uncolossal Chest, Closes #153
Browse files Browse the repository at this point in the history
  • Loading branch information
rubensworks committed Mar 12, 2022
1 parent bde3de9 commit df93650
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.Containers;
import net.minecraft.world.MenuProvider;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.inventory.AbstractContainerMenu;
Expand Down Expand Up @@ -120,6 +121,18 @@ public void tick(BlockState blockState, ServerLevel level, BlockPos pos, Random
}
}

@Override
public void onRemove(BlockState blockState, Level level, BlockPos blockPos, BlockState blockStateNew, boolean p_60519_) {
if (!blockState.is(blockStateNew.getBlock())) {
BlockEntityHelpers.get(level, blockPos, BlockEntityUncolossalChest.class)
.ifPresent(blockEntity -> {
Containers.dropContents(level, blockPos, blockEntity.getInventory());
level.updateNeighbourForOutputSignal(blockPos, this);
});
super.onRemove(blockState, level, blockPos, blockStateNew, p_60519_);
}
}

@Override
public FluidState getFluidState(BlockState blockState) {
return blockState.getValue(WATERLOGGED) ? Fluids.WATER.getSource(false) : super.getFluidState(blockState);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"values": [
"colossalchests:chest_wall_wood",
"colossalchests:colossal_chest_wood",
"colossalchests:interface_wood"
"colossalchests:interface_wood",
"colossalchests:uncolossal_chest"
]
}

0 comments on commit df93650

Please sign in to comment.