Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-4470

API Method to check if block is swimmable

XMLWordPrintable

    • Icon: New Feature New Feature
    • Resolution: Duplicate
    • Icon: Minor Minor
    • None
    • None
    • 1.13 +
    • Yes

      Hello champs!
      Perhaps this feature has already be added, if so I can't seem to find it in the docs.
      I'm looking for a convenience method to check if a block is waterlike. For instance to be able to check if a player can swim at a certain position.
      The problem is in 1.13 block.isLiquid() does not suffice.
      It works for water and lava, but all the waterlogged blocks of course report false.
      Checking manually if the state is waterlogged is an option, but it gets very tedious if you have to check against all waterlogged blocks and also stuff like kelp or seagrass, which is always waterlogged. Also there might be more 'inheritly' waterlogged blocks in the future which you'd need to add to your code. I think there should be some extra method on block or so, which reports if the block is either water or waterlogged or defaultly waterlogged (like kelp). .isSwimmable() or something?

      With kind regards,
      Kasper

            Unassigned Unassigned
            7kasper 7kasper
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: