CompactNPCLib
CompactNPCLib copied to clipboard
Move code is only compatible with 1.11
In 1.11, they added a movetype enum which broke the move function.
https://github.com/InventivetalentDev/CompactNPCLib/blob/master/API/src/main/java/org/inventivetalent/npclib/entity/NPCEntity.java
In the old code, you just linked it directly to the function, but to make it 1.11 compatible I needed to add a method body that calls the new function with the (I think) correct MoveType enum. The issue with that is the code is not compatible with 1.10.2 and older since those versions do not have that enum. If I remember correctly, it fails during injection due to the lack of the enum.
There are a few ways to fix this:
- Use reflection in the post-compile method body (Lower performance)
- Somehow make it have a different method body based on version (Faster but I have not found a legal way to do this)
I think that when the method was implemented, it was not expected to change, but it seems more fit to put the method into NPCAbstract
I've added some conditions to the @ExtraMethod annotation to specify the version range to generate methods:
https://github.com/InventivetalentDev/CompactNPCLib/commit/74a82e4ca22b971125803b8d226e6bc63da4dccf
Adding it to the move() method should make this compatible with older versions now
https://github.com/InventivetalentDev/CompactNPCLib/commit/e51078cbd0a91167984d5fd2852cf2ba386c5faa