From 309ebaa29dd3b76e9ec5de7b245c16a8f0d3b071 Mon Sep 17 00:00:00 2001 From: quat1024 Date: Sun, 30 Jul 2023 22:17:09 -0400 Subject: [PATCH] Respect doTileDrops (rel: #1) --- .../cottonmc/templates/api/TemplateInteractionUtil.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java b/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java index fec4bdf..eceadcf 100644 --- a/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java +++ b/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java @@ -30,6 +30,7 @@ import net.minecraft.util.math.Direction; import net.minecraft.util.shape.VoxelShape; import net.minecraft.util.shape.VoxelShapes; import net.minecraft.world.BlockView; +import net.minecraft.world.GameRules; import net.minecraft.world.World; import org.jetbrains.annotations.Nullable; @@ -119,8 +120,12 @@ public class TemplateInteractionUtil { return ActionResult.PASS; } + //Maybe an odd spot to put this logic but it's consistent w/ vanilla chests, barrels, etc public static void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) { - if(!state.isOf(newState.getBlock()) && world.getBlockEntity(pos) instanceof TemplateEntity template) { + if(!state.isOf(newState.getBlock()) && + world.getBlockEntity(pos) instanceof TemplateEntity template && + world.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) + ) { DefaultedList drops = DefaultedList.of(); //TODO: remember the specific ItemStack