From e108fec57a4ea348380590fd76148bbb7d30d536 Mon Sep 17 00:00:00 2001 From: direwolf20 <39863894+Direwolf20-MC@users.noreply.github.com> Date: Fri, 18 Oct 2024 18:15:04 -0400 Subject: [PATCH] Added support for filtering fluid blocks in clicker - resolves #229 --- .../justdirethings/common/blockentities/ClickerT2BE.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/direwolf20/justdirethings/common/blockentities/ClickerT2BE.java b/src/main/java/com/direwolf20/justdirethings/common/blockentities/ClickerT2BE.java index b7fa7e7a..86976453 100644 --- a/src/main/java/com/direwolf20/justdirethings/common/blockentities/ClickerT2BE.java +++ b/src/main/java/com/direwolf20/justdirethings/common/blockentities/ClickerT2BE.java @@ -15,6 +15,7 @@ import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.level.block.LiquidBlock; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.phys.AABB; @@ -97,7 +98,10 @@ public InteractionResult clickBlock(ItemStack itemStack, UsefulFakePlayer fakePl public boolean isBlockPosValid(FakePlayer fakePlayer, BlockPos blockPos) { if (!super.isBlockPosValid(fakePlayer, blockPos)) return false; //Do the same checks as normal, then check the filters - ItemStack blockItemStack = level.getBlockState(blockPos).getCloneItemStack(new BlockHitResult(Vec3.ZERO, getDirectionValue(), blockPos, false), level, blockPos, fakePlayer); + BlockState blockState = level.getBlockState(blockPos); + if ((blockState.getBlock() instanceof LiquidBlock liquidBlock)) + return isStackValidFilter(liquidBlock); + ItemStack blockItemStack = blockState.getCloneItemStack(new BlockHitResult(Vec3.ZERO, getDirectionValue(), blockPos, false), level, blockPos, fakePlayer); return isStackValidFilter(blockItemStack); }