1.16.5 Get Targeted Fluid

Discussion in 'Spigot Plugin Development' started by torpkev, Dec 22, 2020.

  1. I'm trying to determine if the water the player is looking at is deep enough for what I want to do.. I know I can get the targeted block (player.getTargetBlock()) but it doesn't seem to return the water.

    Shown here:


    But I don't see that in my code:


    Am I just missing it, or is there some other way to get at the water being targeted?

  2. Code (Text):
    player.getTargetBlock(Set<Material> transparent, int maxDistance)
    You can set 'transparent' to null, so itll only ignore AIR.

    Code (Text):
    Block b = player.getTargetBlock(null, 10);
    Should get the block, even if fluid
    #2 Em202020, Dec 22, 2020
    Last edited: Dec 22, 2020