Skip to content

Commit

Permalink
Added support for filtering fluid blocks in clicker - resolves #229
Browse files Browse the repository at this point in the history
  • Loading branch information
Direwolf20-MC committed Oct 18, 2024
1 parent a9e4493 commit e108fec
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit e108fec

Please sign in to comment.