Hello Everyone, I'm working on a gravity chestplate that gives creative flight. I'm new to this and I've run into a problem. When the player takes off the gravity chestplate they can still fly how would I fix this? If someone knows what to add to my code and would like to help I would appreciate it.
public class GravityArmor extends ItemArmor
{
public GravityArmor(ArmorMaterial armormaterial, int renderID, int partID)
{
super(armormaterial, renderID, partID);
}
My code
package com.skullcrusher.BetterThings.Armor;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor.ArmorProperties;
import com.skullcrusher.BetterThings.BetterThings;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class GravityArmor extends ItemArmor
{
public GravityArmor(ArmorMaterial armormaterial, int renderID, int partID)
{
super(armormaterial, renderID, partID);
}
public String getArmorTexture(ItemStack itemstack, Entity entity, int slot, String layer)
{
if((itemstack.getItem() == BetterThings.GravityChestplate))
{
return "betterthings:textures/models/armor/8_layer_1.png";
}
else return null;
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack armor) {
player.capabilities.allowFlying=true;
}
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4)
{
list.add(EnumChatFormatting.DARK_BLUE + "Indestructible");
}
}