Advertisement
Millu

Flying Armor Event

Feb 15th, 2015
900
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. @Override
  2. public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack){
  3. {
  4. if(player.capabilities.allowFlying == false){
  5. player.capabilities.allowFlying=true;
  6. }
  7. }
  8. }
  9. /**
  10. * Called each tick as long the item is on a player inventory. Uses by maps to check if is on a player hand and
  11. * update it's contents.
  12. */
  13.  
  14. public void onUpdate(ItemStack itemstack, World world, Entity entity, int p_77663_4_, boolean p_77663_5_){
  15. {
  16. if (entity != null)
  17. {
  18. if(entity instanceof EntityPlayer)
  19. {
  20. EntityPlayer player = ((EntityPlayer)entity);
  21. if(player.inventory.armorItemInSlot(2) == null){
  22. if(player.capabilities.allowFlying == true){
  23. player.capabilities.allowFlying = false;
  24. }
  25. }else if(player.inventory.armorItemInSlot(2).getItem() != mcreator_armorname.body){
  26. if(player.capabilities.allowFlying == true){
  27. player.capabilities.allowFlying = false;
  28. }
  29. }
  30. }
  31. }
  32. }
  33.  
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement