Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I am returning to modding from a four year hiatus, and I wanted to start by recreating a simple plugin I developed back then which created new behaviors for vanilla tools interacting with vanilla blocks. One such behavior in mind requires interaction with the flowing segments of water, but I can't seem to find a BlockInteractEvent that fires when a player attempts to use a tool on them. (I read somewhere that flowing water is considered a gas and not a fluid. Worst case of the imagination, I might suspect a flowing segment of water is not actually a block and is just an effect generated by one or more water source blocks.) I remember it was troublesome to implement back then, too, as I recall having to resort to checking for any right click action with an appropriate tool in hand combined with having flowing water within a few blocks of the player's line-of-sight vector, and today that feels like a bit of a cop-out approach. Are there any suggestions for a simpler and preferably more straightforward method of recognizing when a player uses a tool on flowing water? Thanks in advance!

I'm not 100% sure this works with flowing water, but you could try this...

 

Add an

onItemRightClick

to your item that does a ray trace like this:

final RayTraceResult target = this.rayTrace(world, player, true); // true: useLiquids

if(target.typeOfHit != RayTraceResult.Type.BLOCK) {
  return ActionResult.newResult(EnumActionResult.PASS, itemstack);
}

// ...

 

Edited by Corey

  • Author

I'm not sure about whether it works on flowing water, either. Since I am modifying existing tools, not adding my own, I'd need to do an @Override of the onItemRightClick method for each intended tool, correct? Is that even allowed?

Just now, bulldogg6404 said:

Is that even allowed?

No, use one of the PlayerInteractEvent sub classes. As an event.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

The only PlayerInteractEvent sub class that makes sense here (as far as I know) is RightClickBlock event, and it presents the same issue from the original post of the flowing water not being recognized as a block. The event registers fine with water source blocks, but that's not what I'm looking for.

 

Edit: PlayerInteractEvent.RightClickBlock did not work for me with water sources either; I was mistakenly remembering the results of a different test case.

Edited by bulldogg6404

33 minutes ago, bulldogg6404 said:

The only PlayerInteractEvent sub class that makes sense here (as far as I know) is RightClickBlock event, and it presents the same issue from the original post of the flowing water not being recognized as a block. The event registers fine with water source blocks, but that's not what I'm looking for.

 

Edit: PlayerInteractEvent.RightClickBlock did not work for me with water sources either; I was mistakenly remembering the results of a different test case.

47 minutes ago, bulldogg6404 said:

onItemRightClick

I wonder if there is a sub-class that has a similar name to this where one can to RayTracing to check for flowing water?

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author
11 minutes ago, Animefan8888 said:

I wonder

 

.... well, would you look at that. I for some reason thought that RightClickItem meant it fires when they right click on an item (whatever that was supposed to mean). Thanks, that should be enough to get the ball rolling again.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.