Started by
ImCloud13
on
Topic category: Help with Minecraft modding (Java Edition)
Hello, I need to check if there is a certain type of block or not between an entity and a player. Someone else asked a similar question before but the only answer is a dead link, so that's no help. Please let me know if you have any ideas, thank you!
If you want it to check from the entities' feet,
world.getBlockState(world.clip(new ClipContext(entity1.position(), entity2.position(), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getBlockPos())
If you want it to check from the entities' eyes,
world.getBlockState(world.clip(new ClipContext(entity1.getEyePosition(), entity2.getEyePosition(), ClipContext.Block.COLLIDER, ClipContext.Fluid.NONE, entity)).getBlockPos())