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 ba49ed6..4058cb0 100644 --- a/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java +++ b/src/main/java/io/github/cottonmc/templates/api/TemplateInteractionUtil.java @@ -135,6 +135,7 @@ public class TemplateInteractionUtil { } } + //Returns "null" to signal "no opinion". Imagine it like an InteractionResult.PASS. public static @Nullable VoxelShape getCollisionShape(BlockState state, BlockView view, BlockPos pos, ShapeContext ctx) { return view.getBlockEntity(pos) instanceof TemplateEntity be && !be.isSolid() ? VoxelShapes.empty() : null; } diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java index a5045c1..754ee16 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateBlock.java @@ -40,7 +40,9 @@ public class TemplateBlock extends Block implements BlockEntityProvider { @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - return TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + if(!r.isAccepted()) r = super.onUse(state, world, pos, player, hand, hit); + return r; } @Override diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateCarpetBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateCarpetBlock.java index 60e2054..2ffa42f 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateCarpetBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateCarpetBlock.java @@ -42,7 +42,9 @@ public class TemplateCarpetBlock extends CarpetBlock implements BlockEntityProvi @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - return TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + if(!r.isAccepted()) r = super.onUse(state, world, pos, player, hand, hit); + return r; } @Override diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateFenceBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateFenceBlock.java index 607b2fc..1715ea8 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateFenceBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateFenceBlock.java @@ -42,7 +42,9 @@ public class TemplateFenceBlock extends FenceBlock implements BlockEntityProvide @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - return TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + if(!r.isAccepted()) r = super.onUse(state, world, pos, player, hand, hit); + return r; } @Override diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplatePressurePlateBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplatePressurePlateBlock.java index 5de148c..8fef171 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplatePressurePlateBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplatePressurePlateBlock.java @@ -46,7 +46,9 @@ public class TemplatePressurePlateBlock extends PressurePlateBlock implements Bl @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - return TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + if(!r.isAccepted()) r = super.onUse(state, world, pos, player, hand, hit); + return r; } @Override diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateSlabBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateSlabBlock.java index a85df87..186fd43 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateSlabBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateSlabBlock.java @@ -42,7 +42,9 @@ public class TemplateSlabBlock extends SlabBlock implements BlockEntityProvider @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - return TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + if(!r.isAccepted()) r = super.onUse(state, world, pos, player, hand, hit); + return r; } @Override diff --git a/src/main/java/io/github/cottonmc/templates/block/TemplateWallBlock.java b/src/main/java/io/github/cottonmc/templates/block/TemplateWallBlock.java index 9abfd8c..0f45583 100644 --- a/src/main/java/io/github/cottonmc/templates/block/TemplateWallBlock.java +++ b/src/main/java/io/github/cottonmc/templates/block/TemplateWallBlock.java @@ -50,7 +50,9 @@ public class TemplateWallBlock extends WallBlock implements BlockEntityProvider @Override public ActionResult onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockHitResult hit) { - return TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + ActionResult r = TemplateInteractionUtil.onUse(state, world, pos, player, hand, hit); + if(!r.isAccepted()) r = super.onUse(state, world, pos, player, hand, hit); + return r; } @Override