Backported fall damage cancellation rework.

This commit is contained in:
bconlon 2020-07-18 21:10:45 -07:00
parent cccc9a9b03
commit 50de1ce529
3 changed files with 17 additions and 8 deletions

View file

@ -1,5 +1,7 @@
package com.legacy.aether;
import com.legacy.aether.api.AetherAPI;
import com.legacy.aether.api.player.IPlayerAether;
import com.legacy.aether.entities.passive.mountable.EntityAerbunny;
import com.legacy.aether.entities.projectile.darts.EntityDartBase;
import com.legacy.aether.network.AetherNetwork;
@ -41,6 +43,7 @@ import net.minecraftforge.event.entity.EntityStruckByLightningEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingFallEvent;
import net.minecraftforge.event.entity.player.*;
import com.legacy.aether.blocks.BlocksAether;
@ -365,6 +368,20 @@ AetherEventHandler {
}
}
@SubscribeEvent
public void onFall(LivingFallEvent event)
{
if (event.entityLiving instanceof EntityPlayer)
{
IPlayerAether playerAether = PlayerAether.get((EntityPlayer) event.entityLiving);
if (playerAether.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.sentry_boots)) || playerAether.getAccessoryInventory().isWearingGravititeSet() || playerAether.getAccessoryInventory().isWearingValkyrieSet())
{
event.setCanceled(true);
}
}
}
private void performTimeSet(PlayerWakeUpEvent event, World world, WorldServer worldServer)
{
if (world.getGameRules().getGameRuleBooleanValue("doDaylightCycle") && event.entityPlayer.isPlayerFullyAsleep())

View file

@ -44,8 +44,6 @@ public class AbilityArmor implements IAetherAbility {
this.player.getEntity().motionY = 1D;
this.jumpBoosted = true;
}
this.player.getEntity().fallDistance = -1F;
}
if (this.player.getEntity().isWet()) {
@ -75,10 +73,6 @@ public class AbilityArmor implements IAetherAbility {
}
}
if (this.player.getAccessoryInventory().wearingArmor(new ItemStack(ItemsAether.sentry_boots))) {
this.player.getEntity().fallDistance = 0F;
}
if (!this.player.isJumping() && this.player.getEntity().onGround) {
this.jumpBoosted = false;
}

View file

@ -45,8 +45,6 @@ public class AbilityFlight implements IAetherAbility {
this.flightMod = 1.0D;
}
this.player.getEntity().fallDistance = -1F;
if (this.player.getEntity().onGround) {
this.flightCount = 0;
this.flightMod = 1.0D;