Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.josh.gomc.armor;
- import com.josh.gomc.Main;
- import net.minecraft.entity.Entity;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.item.ItemStack;
- import net.minecraft.item.ItemArmor;
- import net.minecraft.item.ItemArmor.ArmorMaterial;
- import net.minecraft.potion.Potion;
- import net.minecraft.potion.PotionEffect;
- import net.minecraft.world.World;
- public class ItemCaelumFlyingArmor extends ItemArmor{
- private String textureName;
- public ItemCaelumFlyingArmor(ArmorMaterial material, int type, String textureName) {
- super(material, 0, type);
- this.textureName = textureName;
- }
- @Override
- public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
- {
- return "gomc:textures/models/armor/" + this.textureName + "_" + (this.armorType == 2 ? "2" : "1") + ".png";
- }
- @Override
- public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
- if (itemStack.getItem().equals(Main.itemCaelumFlyingHelmet))
- player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 300));
- if (itemStack.getItem().equals(Main.itemCaelumFlyingChestplate))
- player.addPotionEffect(new PotionEffect(Potion.resistance.id, 40, 2));
- if (itemStack.getItem().equals(Main.itemCaelumFlyingLeggings))
- player.addPotionEffect(new PotionEffect(Potion.jump.id, 40, 3));
- if (itemStack.getItem().equals(Main.itemCaelumFlyingBoots))
- player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, 40, 2));
- if(player.getCurrentArmor(3) != null && player.getCurrentArmor(2) != null && player.getCurrentArmor(1) != null && player.getCurrentArmor(0) != null){
- ItemStack helmet = player.getCurrentArmor(3);
- ItemStack chestplate = player.getCurrentArmor(2);
- ItemStack leggings = player.getCurrentArmor(1);
- ItemStack boots = player.getCurrentArmor(0);
- if(helmet.getItem() == Main.itemCaelumFlyingHelmet) {
- if(chestplate.getItem() == Main.itemCaelumFlyingChestplate){
- if(leggings.getItem() == Main.itemCaelumFlyingLeggings){
- if(boots.getItem() == Main.itemCaelumFlyingBoots){
- player.capabilities.allowFlying = true;
- player.fallDistance = 0.0f;
- }
- }
- }
- }
- if(helmet.getItem() != Main.itemCaelumFlyingHelmet || chestplate.getItem() != Main.itemCaelumFlyingChestplate || leggings.getItem() != Main.itemCaelumFlyingLeggings || boots.getItem() != Main.itemCaelumFlyingBoots) {
- player.capabilities.allowFlying = false;
- player.capabilities.isFlying = false;
- }
- }
- }
- }
Add Comment
Please, Sign In to add comment