Trigger procedure when right click water source

Started by CasterMx13 on Wed, 11/02/2022 - 23:02

Topic category: Help with modding (Java Edition)

Last seen on 04:31, 31. Jan 2023
Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Trigger procedure when right click water source
Wed, 11/02/2022 - 23:02

Having difficulties figuring out how to trigger a procedure when a water source block is right clicked. Everything I've tried either doesn't work or requires a solid block to be looked at, any tips/solutions?

Last seen on 22:18, 30. Jan 2023
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Since water isn't a solid…
Thu, 11/03/2022 - 02:30

Since water isn't a solid block that you can click on, you'll have to use some sort of raytracing procedure. You can't detect when the player right clicks on water, but you can detect when the player right clicks, and when the player is targeting water. Alternatively, (for a simpler but slightly jankier solution), you could just check if a water source is above when a player right clicks a solid blocks, or if the player is in water when they right click.

...But if you're looking for the ability to right click a fluid block, you'll probably need to look into the 'raytrace position' blocks.

Last seen on 04:31, 31. Jan 2023
Joined Sep 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Thanks, I managed to get it…
Thu, 11/03/2022 - 07:16

Thanks, I managed to get it working using raytracing.
Tip: For an item trigger, use right-click (entity pos.) not right-clicked on block.