From 22835fdb8508eaa96334f9ef13d55a448cc3223a Mon Sep 17 00:00:00 2001 From: Alex MacLean Date: Sat, 17 Apr 2021 19:07:10 -0400 Subject: [PATCH] Improved Herobrine Mage warp spell. Closes #28 --- .../herobrine/mod/entities/HerobrineMageEntity.java | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/herobrine/mod/entities/HerobrineMageEntity.java b/src/main/java/com/herobrine/mod/entities/HerobrineMageEntity.java index 9a759265..b6044aea 100644 --- a/src/main/java/com/herobrine/mod/entities/HerobrineMageEntity.java +++ b/src/main/java/com/herobrine/mod/entities/HerobrineMageEntity.java @@ -2,7 +2,6 @@ import com.herobrine.mod.util.entities.EntityRegistry; import net.minecraft.block.BlockState; -import net.minecraft.block.Blocks; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; import net.minecraft.entity.LivingEntity; @@ -55,7 +54,7 @@ protected void registerGoals() { this.goalSelector.addGoal(12, new LookRandomlyGoal(this)); } - public static AttributeModifierMap.MutableAttribute registerAttributes() { + public static AttributeModifierMap.@NotNull MutableAttribute registerAttributes() { return MonsterEntity.func_234295_eP_() .createMutableAttribute(Attributes.MAX_HEALTH, 40.0D) .createMutableAttribute(Attributes.ATTACK_DAMAGE, 4.0D) @@ -162,10 +161,13 @@ public void livingTick() { int z = (int) entity.getPosZ(); BlockState block = world.getBlockState(new BlockPos(x, y + 3, z)); BlockState blockAt = world.getBlockState(new BlockPos(x, y + 4, z)); - if (blockAt.getBlock() == Blocks.AIR.getDefaultState().getBlock() && block.getBlock() == Blocks.AIR.getDefaultState().getBlock() || blockAt.getBlock() == Blocks.CAVE_AIR.getDefaultState().getBlock() && block.getBlock() == Blocks.CAVE_AIR.getDefaultState().getBlock() || blockAt.getBlock() == Blocks.CAVE_AIR.getDefaultState().getBlock() && block.getBlock() == Blocks.AIR.getDefaultState().getBlock() || blockAt.getBlock() == Blocks.AIR.getDefaultState().getBlock() && block.getBlock() == Blocks.CAVE_AIR.getDefaultState().getBlock()) { + if (blockAt.getBlockState().isAir() && block.getBlockState().isAir()) { + if(entity.getRidingEntity() != null) { + entity.stopRiding(); + } entity.setPositionAndUpdate(x, y + 4, z); if (!this.world.isRemote) { - this.world.setEntityState(this, (byte)4); + this.world.setEntityState(this, (byte) 4); } } }