Skip to content

Commit

Permalink
removed slot check
Browse files Browse the repository at this point in the history
  • Loading branch information
LudoCrypt committed Sep 7, 2022
1 parent 579752e commit 7f4175f
Showing 1 changed file with 6 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,7 @@
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.ElytraItem;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.level.Level;

@Mixin(value = LivingEntity.class, priority = 1200)
Expand All @@ -48,11 +46,8 @@ public MixinLivingEntity(EntityType<?> entityType, Level world) {

@ModifyArg(method = "Lnet/minecraft/world/entity/LivingEntity;travel(Lnet/minecraft/world/phys/Vec3;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;setSharedFlag(IZ)V"), index = 1)
private boolean elytraBounce$travel(boolean in) {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST);
if (itemstack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemstack)) {
if (ticksOnGround <= 5) {
return true;
}
if (ticksOnGround <= 5) {
return true;
}

return in;
Expand All @@ -61,13 +56,10 @@ public MixinLivingEntity(EntityType<?> entityType, Level world) {
@Inject(method = "Lnet/minecraft/world/entity/LivingEntity;updateFallFlying()V", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/entity/LivingEntity;setSharedFlag(IZ)V", shift = Shift.AFTER), locals = LocalCapture.CAPTURE_FAILHARD)
private void elytraBounce$updateFallFlying(CallbackInfo ci, boolean flag) {
if (wasGoodBefore && !flag && this.isOnGround()) {
ItemStack itemstack = this.getItemBySlot(EquipmentSlot.CHEST);
if (itemstack.is(Items.ELYTRA) && ElytraItem.isFlyEnabled(itemstack)) {
ticksOnGround++;
wasGoodBefore = true;
this.setSharedFlag(7, true);
return;
}
ticksOnGround++;
wasGoodBefore = true;
this.setSharedFlag(7, true);
return;
}

ticksOnGround = 0;
Expand Down

0 comments on commit 7f4175f

Please sign in to comment.