- 3
- 0
Всем привет, я новичок поэтому простите если туплю.
Хочу сделать чтобы при одевании брони игроку давался полет и некоторые эффекты.
Хочу сделать чтобы при одевании брони игроку давался полет и некоторые эффекты.
Java:
public class ArmorBase extends ItemArmor implements HasModel {
public ArmorBase(String name, ArmorMaterial materialIn, int renderIndexIn, EntityEquipmentSlot equipmentSlotIn) {
super(materialIn, renderIndexIn, equipmentSlotIn);
setRegistryName(name);
setUnlocalizedName(name);
setCreativeTab(Main.ETRA_TAB);
InitItems.ITEMS.add(this);
setMaxDamage((int) Double.NEGATIVE_INFINITY);
}
@Override
public void onArmorTick(final World world, final EntityPlayer player, final ItemStack itemStack) {
player.capabilities.allowFlying = false;
if (!(player.getEquipmentAndArmor().equals(null))) {
player.capabilities.allowFlying = true;
System.out.println("True flihgt");
player.addPotionEffect(new PotionEffect(Potion.getPotionById(12), 40));
player.addPotionEffect(new PotionEffect(Potion.getPotionById(1), 40));
player.addPotionEffect(new PotionEffect(Potion.getPotionById(16), 100, 0));
player.addPotionEffect(new PotionEffect(Potion.getPotionById(10), 2, 1));
} else {
System.out.println("False flight");
player.fallDistance = 0.0F;
player.capabilities.allowFlying = false;
}
}
@Override
public void registerModels() {
Main.proxy.registerItemRender(this, 0, "inventory");
}
}
Последнее редактирование: