Advertisement
Guest User

Untitled

a guest
May 10th, 2016
148
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.70 KB | None | 0 0
  1. package com.rbs.slurpiesdongles.armor;
  2.  
  3. import com.rbs.slurpiesdongles.SlurpiesDongles;
  4. import com.rbs.slurpiesdongles.init.SlurpiesDonglesItems;
  5. import net.minecraft.entity.Entity;
  6. import net.minecraft.entity.player.EntityPlayer;
  7. import net.minecraft.inventory.EntityEquipmentSlot;
  8. import net.minecraft.item.ItemArmor;
  9. import net.minecraft.item.ItemStack;
  10. import net.minecraft.potion.Potion;
  11. import net.minecraft.potion.PotionEffect;
  12. import net.minecraft.world.World;
  13.  
  14. import java.util.List;
  15.  
  16. /**
  17. * Created by RedBu on 3/21/2016.
  18. */
  19. public class ArmorTopazArmor extends ItemArmor {
  20.  
  21. public ArmorTopazArmor(ArmorMaterial material, int renderIndex, EntityEquipmentSlot equipmentSlot) {
  22.  
  23. super(material, renderIndex, equipmentSlot);
  24. setCreativeTab(SlurpiesDongles.tabSlurpiesDongles);
  25. }
  26.  
  27.  
  28. @Override
  29. public String getArmorTexture(ItemStack stack, Entity entity, EntityEquipmentSlot equipmentSlotIn, String layer) {
  30. if (equipmentSlotIn != EntityEquipmentSlot.LEGS) {
  31. return "slurpiesdongles:textures/models/armor/topaz_layer_1.png";
  32. } else
  33. {
  34. return "slurpiesdongles:textures/models/armor/topaz_layer_2.png";
  35. }
  36.  
  37. }
  38. @Override
  39. public void onArmorTick(World world, EntityPlayer player, ItemStack stack) {
  40. if (stack.getItem() == SlurpiesDonglesItems.topaz_helmet) {
  41. this.effectPlayer(player, Potion.getPotionById(16), 0);
  42.  
  43. }if (stack.getItem() == SlurpiesDonglesItems.topaz_leggings) {
  44. this.effectPlayer(player, Potion.getPotionById(1), 0);
  45.  
  46. }if (stack.getItem() == SlurpiesDonglesItems.topaz_chestplate) {
  47. this.effectPlayer(player, Potion.getPotionById(12), 0);
  48. {
  49. if (player.getItemStackFromSlot(EntityEquipmentSlot.HEAD) !=null && player.getItemStackFromSlot(EntityEquipmentSlot.HEAD).getItem() == SlurpiesDonglesItems.topaz_helmet
  50. && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST) !=null && player.getItemStackFromSlot(EntityEquipmentSlot.CHEST).getItem() == SlurpiesDonglesItems.topaz_chestplate
  51. && player.getItemStackFromSlot(EntityEquipmentSlot.LEGS) !=null && player.getItemStackFromSlot(EntityEquipmentSlot.LEGS).getItem() == SlurpiesDonglesItems.topaz_leggings
  52. && player.getItemStackFromSlot(EntityEquipmentSlot.FEET) !=null && player.getItemStackFromSlot(EntityEquipmentSlot.FEET).getItem() == SlurpiesDonglesItems.topaz_boots)
  53. {
  54. if (!player.capabilities.isCreativeMode)
  55. {
  56. if (!player.capabilities.allowFlying)
  57. {
  58. player.capabilities.allowFlying = true;
  59. }
  60. }
  61. }
  62. else
  63. {
  64. if (!player.capabilities.isCreativeMode)
  65. {
  66. player.capabilities.isFlying = false;
  67. player.capabilities.allowFlying = false;
  68. }
  69. }
  70. }
  71. }
  72. }
  73. @Override
  74. public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
  75. {
  76. list.add("Wearing full set gives you flight!");
  77. }
  78.  
  79.  
  80. public void effectPlayer(EntityPlayer player, Potion potion, int amplifier){
  81.  
  82. if(player.getActivePotionEffect(potion) == null || player.getActivePotionEffect(potion).getDuration() <= 1000){
  83. player.addPotionEffect(new PotionEffect(potion, 1000, amplifier, true, true));
  84. }
  85. }
  86.  
  87. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement