mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-30 16:28:00 +01:00
Fixed crystal shard entities attaching to blocks outside the world bounds
This commit is contained in:
parent
352f6588d4
commit
5cc2bcc0e4
1 changed files with 4 additions and 1 deletions
|
@ -9,6 +9,7 @@ import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.minelittlepony.unicopia.USounds;
|
import com.minelittlepony.unicopia.USounds;
|
||||||
import com.minelittlepony.unicopia.item.UItems;
|
import com.minelittlepony.unicopia.item.UItems;
|
||||||
|
import com.minelittlepony.unicopia.particle.ParticleUtils;
|
||||||
|
|
||||||
import net.minecraft.block.SideShapeType;
|
import net.minecraft.block.SideShapeType;
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
|
@ -19,6 +20,7 @@ import net.minecraft.fluid.Fluids;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NbtCompound;
|
import net.minecraft.nbt.NbtCompound;
|
||||||
import net.minecraft.nbt.NbtElement;
|
import net.minecraft.nbt.NbtElement;
|
||||||
|
import net.minecraft.particle.ParticleTypes;
|
||||||
import net.minecraft.predicate.entity.EntityPredicates;
|
import net.minecraft.predicate.entity.EntityPredicates;
|
||||||
import net.minecraft.server.world.ServerWorld;
|
import net.minecraft.server.world.ServerWorld;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
|
@ -71,7 +73,7 @@ public class CrystalShardsEntity extends StationaryObjectEntity {
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean isInvalid(World world, BlockPos crystalPos, Direction attachmentFace) {
|
static boolean isInvalid(World world, BlockPos crystalPos, Direction attachmentFace) {
|
||||||
if (!world.isAir(crystalPos)) {
|
if (!world.isAir(crystalPos) || world.isOutOfHeightLimit(crystalPos)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
BlockPos attachmentPos = crystalPos.offset(attachmentFace.getOpposite());
|
BlockPos attachmentPos = crystalPos.offset(attachmentFace.getOpposite());
|
||||||
|
@ -172,6 +174,7 @@ public class CrystalShardsEntity extends StationaryObjectEntity {
|
||||||
|
|
||||||
if (isDead() || isInvalid(getWorld(), getBlockPos(), getAttachmentFace())) {
|
if (isDead() || isInvalid(getWorld(), getBlockPos(), getAttachmentFace())) {
|
||||||
kill();
|
kill();
|
||||||
|
ParticleUtils.spawnParticles(ParticleTypes.CLOUD, this, 10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue