Guest User

sanityEventHandler.java

a guest
Mar 20th, 2017
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.97 KB | None | 0 0
  1. package com.ignatio.wilsonsanity;
  2.  
  3. import cpw.mods.fml.common.eventhandler.SubscribeEvent;
  4. import net.minecraft.entity.player.EntityPlayer;
  5. import net.minecraftforge.event.entity.EntityEvent.EntityConstructing;
  6.  
  7. public class sanityEventHandler
  8. {
  9. // 1.6.4: @ForgeSubscribe
  10. @SubscribeEvent
  11. public void onEntityConstructing(EntityConstructing event)
  12. {
  13. /*
  14. Be sure to check if the entity being constructed is the correct type
  15. for the extended properties you're about to add!
  16. The null check may not be necessary - I only use it to make sure
  17. properties are only registered once per entity
  18. */
  19. if (event.entity instanceof EntityPlayer && ExtendedPlayer.get((EntityPlayer) event.entity) == null)
  20. // This is how extended properties are registered using our convenient method from earlier
  21. ExtendedPlayer.register((EntityPlayer) event.entity);
  22. // That will call the constructor as well as cause the init() method
  23. // to be called automatically
  24. }
  25.  
  26. }
Advertisement
Add Comment
Please, Sign In to add comment