Make ender slimes trigger the EnderTeleportEvent, so it can be blocked by other mods.
Flanks255 opened this issue ยท 11 comments
Minecraft Version
1.16.5
Forge Version
any
Mantle Version
any
Tinkers' Construct Version
any
Problem description
Ender slimes do not trigger the EnderTeleportEvent.
Suggested solution
Trigger the EnderTeleportEvent so the teleporting can be modified by other mods handling the event.
Alternatives considered
.
Additional context
Discussed with KnightMiner in discord.
Related to:
DarkPacks/SkyFactory-One#35
vadis365/Mob-Grinding-Utils#177
- Confirm you have checked the roadmap, what's new, and the FAQ for your issue
Ender slime event extends enderentity, sling extends enderpearl, spill+drink extends chorusfruit?
The ender pearl event requires an ender pearl entity. Sling has none. It also violates the intention of the events, as someone expects an ender pearl when its fired.
Chorus fruit could arguably be extended by spilling, but that would be a huge semantic break so not really worth it. If someone adds a behavior specific to chorus fruit, it would not make sense for it to act from other types of teleports.
So the only one that makes sense for our events to extend is the ender teleport event as it can be argued that ender slimes are an ender mob. It cannot be argued that slimeslings are an ender pearl or the fluid is chorus fruit.
You mean like 0ac703a? Just committed it yesterday, but did not have an issue to link it to, so linking the commit to it
For the record, I currently have ender slime firing the normal entity teleport event (well, a sub event) as it allows me to provide greater context. I could fire the forge ender variant, but that means it becomes harder to distinguish my event from the vanilla entities. I think you might be using the legacy event in Mob Grinding Utils, which is deprecated in 1.16 and slated for removal in 1.17
Sorry, i just had forgotten to make the issue after we talked lol.
as for being deprecated, EnderTeleportEvent is the valid event in 1.16, its equiv in 1.17 is EntityTeleportEvent.EnderEntity, or EntityTeleportEvent.ChorusFruit
That equivalent exists in 1.16 as well. So I did not see a point in firing the deprecated event just to remove it when I update.
I don't think you will have a loss of compatability if you listen to the new events instead of the old ones, or honestly you could listen to both as forge structures their events so if the old one is canceled, the new does not run. If you want to convince me that I should fire the deprecated events as well, may be easier to have that discussion on discord.
So i did not know the new version existed in 1.16, fair enough :)
Then just make the ender slime trigger EntityTeleportEvent.EnderEntity then? as we can hook that, but cant hook the tinkers subclass event?
Currently it fires a subclass of EntityTeleportEvent
but not EntityTeleportEvent.EnderEntity
. I could make it extend the latter, would not be hard. However, that would mean a small violation of the javadoc which claims that is for endermen and shulkers. If you think that is fine, its a trivial change to make it happen
That said, all that will solve is teleports from the mob. I am told your logic also prevents ender pearl teleports, which means logically you would want to prevent ender slime slings and teleports from spilling/drinking liquid enderslime, neither of which have a good event to extend other than the base entity teleport event.
I have made the mob event extend EntittyTeleportEvent.EnderEvent
in db75c31. So you should be able to safely cancel that event if you only want to prevent teleports from endermen/slimes/shulkers
Will be in the next release, but next release is blocked by one other feature as its already going to be an addon breaking release
The comment at https://github.com/SlimeKnights/TinkersConstruct/blob/31528ec/src/main/java/slimeknights/tconstruct/library/utils/TeleportHelper.java#L36 implies that the ITeleportEventFactory.create() method should fire the event, but the lambda at https://github.com/SlimeKnights/TinkersConstruct/blob/e08a595/src/main/java/slimeknights/tconstruct/world/entity/EnderSlimeEntity.java#L17 only constructs it, nothing appears to post the event.
c1aae7d fixes this, released in 3.2.1.296