Advertisement
Creepinson

Untitled

Jun 25th, 2017
321
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1.  
  2. @SubscribeEvent
  3.  
  4. public void attachCapability(AttachCapabilitiesEvent.Entity event)
  5.  
  6. {
  7.  
  8. if (!(event.getEntity() instanceof EntityPlayer))
  9. return;
  10.  
  11. if (event.getEntity().hasCapability(DisguiseProvider.DISGUISE, null)) {
  12. System.out.println("Player already has capability");
  13. return;
  14. }
  15. event.addCapability(new ResourceLocation(Utils.MODID, "idisguise"), new DisguiseProvider());
  16.  
  17. }
  18.  
  19. @SubscribeEvent
  20.  
  21. public void onPlayerClone(PlayerEvent.Clone event)
  22.  
  23. {
  24.  
  25. EntityPlayer player = event.getEntityPlayer();
  26.  
  27. IDisguise render = player.getCapability(DisguiseProvider.DISGUISE, null);
  28.  
  29. IDisguise oldRender = event.getOriginal().getCapability(DisguiseProvider.DISGUISE, null);
  30.  
  31. render.setID(oldRender.getID());
  32.  
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement