From 5cc2bcc0e46dc23715a5f9f60db3bc2044460261 Mon Sep 17 00:00:00 2001 From: Sollace Date: Thu, 14 Sep 2023 18:06:08 +0100 Subject: [PATCH] Fixed crystal shard entities attaching to blocks outside the world bounds --- .../unicopia/entity/mob/CrystalShardsEntity.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/minelittlepony/unicopia/entity/mob/CrystalShardsEntity.java b/src/main/java/com/minelittlepony/unicopia/entity/mob/CrystalShardsEntity.java index 3645df37..c23327d5 100644 --- a/src/main/java/com/minelittlepony/unicopia/entity/mob/CrystalShardsEntity.java +++ b/src/main/java/com/minelittlepony/unicopia/entity/mob/CrystalShardsEntity.java @@ -9,6 +9,7 @@ import org.jetbrains.annotations.Nullable; import com.minelittlepony.unicopia.USounds; import com.minelittlepony.unicopia.item.UItems; +import com.minelittlepony.unicopia.particle.ParticleUtils; import net.minecraft.block.SideShapeType; import net.minecraft.entity.EntityType; @@ -19,6 +20,7 @@ import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NbtCompound; import net.minecraft.nbt.NbtElement; +import net.minecraft.particle.ParticleTypes; import net.minecraft.predicate.entity.EntityPredicates; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.BlockPos; @@ -71,7 +73,7 @@ public class CrystalShardsEntity extends StationaryObjectEntity { } static boolean isInvalid(World world, BlockPos crystalPos, Direction attachmentFace) { - if (!world.isAir(crystalPos)) { + if (!world.isAir(crystalPos) || world.isOutOfHeightLimit(crystalPos)) { return true; } BlockPos attachmentPos = crystalPos.offset(attachmentFace.getOpposite()); @@ -172,6 +174,7 @@ public class CrystalShardsEntity extends StationaryObjectEntity { if (isDead() || isInvalid(getWorld(), getBlockPos(), getAttachmentFace())) { kill(); + ParticleUtils.spawnParticles(ParticleTypes.CLOUD, this, 10); } }