Listening to Ice Melting

I can’t seem to find an event that fires when ice transitions into water. I would think it’d be under BlockChangeEvent but using a debug that prints to the console when that happens, nothing pops up when ice melts.

Thanks,
Venom

Have you tried ChangeBlockEvent.Modify?

It’s going to be a ChangeBlockEvent.Place if anything, since the transactions will include the original state of ice and the new state of stationary water.

1 Like

As I found out earlier today, place is when blocktypes change, modify is when only the blockstate changes.

That’s weird. Maybe that should be changed.

That was my solution to preventing ice melting. Has the side effect that players breaking ice goes to air not water but better than nothing :stuck_out_tongue:

Thanks to everyone who responded, I will be looking into all of them when I get a chance.

You could also do the more normal thing to do and do .getType().equals(BlockTypes.ICE) and .getType().equals(BlockTypes.WATER).

As for the logic, you could always make sure that event.getCause().first(Player.class) is not present().

Reason I used strings is because I am using pixelmon and looking for non minecraft blocks and decided just using the pixelmon string was easiest. As for the player being empty I did try that but something about it didn’t work, I forget tho it was 4am when I did that code :stuck_out_tongue:

… pixelmon string?
no entiendo

“pixelmon:Trading_Machine” as the string for the name of the block. Because I used that I used strings elsewhere on blocks.

It’s always desirable to use static references instead of getting them from strings; the strings might change, but the reference won’t.