Thread:LOTRMod/@comment-29954640-20170223220430/@comment-25101690-20170301000057

Campinator wrote: Whoa Sinth that sheds a lot of light on this.

Did you come up with that on the spot, or have you been planning? :P

I regularly travel to the future to read your mind so I can work on your code needs already weeks in advance :P

I was just working on the EventHandler of my own mod and I had the LOTR mod open in jdgui, so I figured I could quickly do it. I started by looking into LOTRWaypoints, but found no method to add a new custom waypoint there, so I searched for further mentions and found what I was looking for in LOTRGuiMap, the map interface where you can create custom waypoints. They are created by sending the LOTRPacketDeleteCWP packet, which requires a waypoint name and a player object.

In Minecraft you can do almost everyting with event listeners (although there are often easier and better ways). To actually use the code somewhere I needed an event that is fired when a player dies but before he respawns. Looking through some documentation, the LivingDeathEvent serves that purpose, but it is fired for all EntityLiving dying and for all dimensions. We can only create waypoints for players in the Middle Earth dimension, so we have to check for these two conditions.

All in all, the initial Forge IDE setup took more time than writing this code. I had no way to test it though, so it might be completely wrong.