Enchantment affect elytra (#448)
This commit is contained in:
parent
913516d35b
commit
4cf563fc68
2 changed files with 10 additions and 8 deletions
|
@ -19,7 +19,6 @@ import ru.betterend.interfaces.MultiModelItem;
|
||||||
import ru.betterend.registry.EndItems;
|
import ru.betterend.registry.EndItems;
|
||||||
|
|
||||||
public class ArmoredElytra extends BaseArmorItem implements MultiModelItem, FallFlyingItem {
|
public class ArmoredElytra extends BaseArmorItem implements MultiModelItem, FallFlyingItem {
|
||||||
|
|
||||||
private final ResourceLocation wingTexture;
|
private final ResourceLocation wingTexture;
|
||||||
private final Item repairItem;
|
private final Item repairItem;
|
||||||
private final double movementFactor;
|
private final double movementFactor;
|
||||||
|
@ -30,12 +29,11 @@ public class ArmoredElytra extends BaseArmorItem implements MultiModelItem, Fall
|
||||||
super(
|
super(
|
||||||
material,
|
material,
|
||||||
EquipmentSlot.CHEST,
|
EquipmentSlot.CHEST,
|
||||||
fireproof ? EndItems.makeEndItemSettings()
|
fireproof ? EndItems
|
||||||
.durability(durability)
|
.makeEndItemSettings()
|
||||||
.rarity(Rarity.EPIC)
|
.durability(durability)
|
||||||
.fireResistant() : EndItems.makeEndItemSettings()
|
.rarity(Rarity.EPIC)
|
||||||
.durability(durability)
|
.fireResistant() : EndItems.makeEndItemSettings().durability(durability).rarity(Rarity.EPIC)
|
||||||
.rarity(Rarity.EPIC)
|
|
||||||
);
|
);
|
||||||
this.wingTexture = BetterEnd.makeID("textures/entity/" + name + ".png");
|
this.wingTexture = BetterEnd.makeID("textures/entity/" + name + ".png");
|
||||||
this.repairItem = repairItem;
|
this.repairItem = repairItem;
|
||||||
|
|
|
@ -20,6 +20,9 @@ import net.minecraft.world.entity.animal.FlyingAnimal;
|
||||||
import net.minecraft.world.item.ElytraItem;
|
import net.minecraft.world.item.ElytraItem;
|
||||||
import net.minecraft.world.item.Item;
|
import net.minecraft.world.item.Item;
|
||||||
import net.minecraft.world.item.ItemStack;
|
import net.minecraft.world.item.ItemStack;
|
||||||
|
import net.minecraft.world.item.enchantment.Enchantment;
|
||||||
|
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||||
|
import net.minecraft.world.item.enchantment.Enchantments;
|
||||||
import net.minecraft.world.level.Level;
|
import net.minecraft.world.level.Level;
|
||||||
import net.minecraft.world.phys.AABB;
|
import net.minecraft.world.phys.AABB;
|
||||||
import net.minecraft.world.phys.Vec3;
|
import net.minecraft.world.phys.Vec3;
|
||||||
|
@ -145,7 +148,8 @@ public abstract class LivingEntityMixin extends Entity {
|
||||||
boolean isFlying = getSharedFlag(7);
|
boolean isFlying = getSharedFlag(7);
|
||||||
if (isFlying && !onGround && !isPassenger() && !hasEffect(MobEffects.LEVITATION)) {
|
if (isFlying && !onGround && !isPassenger() && !hasEffect(MobEffects.LEVITATION)) {
|
||||||
if (ElytraItem.isFlyEnabled(itemStack)) {
|
if (ElytraItem.isFlyEnabled(itemStack)) {
|
||||||
if ((fallFlyTicks + 1) % 20 == 0) {
|
int level = 20 + EnchantmentHelper.getItemEnchantmentLevel(Enchantments.UNBREAKING, itemStack) * 5;
|
||||||
|
if ((fallFlyTicks + 1) % level == 0) {
|
||||||
itemStack.hurtAndBreak(
|
itemStack.hurtAndBreak(
|
||||||
1,
|
1,
|
||||||
LivingEntity.class.cast(this),
|
LivingEntity.class.cast(this),
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue