Aerbunnies can no longer be damaged when on the player's head.

This commit is contained in:
bconlon 2020-07-13 15:53:28 -07:00
parent 70a8d8eb49
commit 1beab1999a

View file

@ -1,5 +1,6 @@
package com.legacy.aether;
import com.legacy.aether.entities.passive.mountable.EntityAerbunny;
import com.legacy.aether.network.AetherNetwork;
import com.legacy.aether.network.packets.PacketSendEternalDay;
import com.legacy.aether.network.packets.PacketSendShouldCycle;
@ -35,6 +36,7 @@ import net.minecraft.world.World;
import net.minecraft.world.WorldProvider;
import net.minecraft.world.WorldServer;
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.player.*;
@ -238,7 +240,7 @@ AetherEventHandler {
}
@SubscribeEvent
public void onEntityHurt(EntityStruckByLightningEvent event)
public void onEntityStruckByLightning(EntityStruckByLightningEvent event)
{
if (event.entity instanceof EntityPlayer)
{
@ -251,6 +253,20 @@ AetherEventHandler {
}
}
@SubscribeEvent
public void onEntityDamage(LivingAttackEvent event)
{
if (event.entityLiving instanceof EntityAerbunny)
{
EntityAerbunny aerbunny = (EntityAerbunny) event.entityLiving;
if (aerbunny.isRiding() && aerbunny.ridingEntity instanceof EntityPlayer)
{
event.setCanceled(true);
}
}
}
@SubscribeEvent
public void onEntityAttack(AttackEntityEvent event)
{