Paper/patches/server/0023-Remove-invalid-mob-spawner-tile-entities.patch

35 lines
2.1 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 15:08:03 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities
diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
index 4a13b18ce609fc6a86da48b0673ccf9d3e0d8292..be1d7d2be46c746b593c3842030412940e2e57f8 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
2021-06-12 00:37:16 +02:00
@@ -46,10 +46,12 @@ import net.minecraft.world.level.TickList;
2021-06-11 14:02:28 +02:00
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.EntityBlock;
+import net.minecraft.world.level.block.SpawnerBlock;
import net.minecraft.world.level.block.entity.BlockEntity;
2021-06-12 00:37:16 +02:00
import net.minecraft.world.level.block.entity.BlockEntityTicker;
import net.minecraft.world.level.block.entity.BlockEntityType;
import net.minecraft.world.level.block.entity.TickingBlockEntity;
2021-06-11 14:02:28 +02:00
+import net.minecraft.world.level.block.entity.SpawnerBlockEntity;
import net.minecraft.world.level.block.state.BlockState;
2021-06-12 00:37:16 +02:00
import net.minecraft.world.level.gameevent.EuclideanGameEventDispatcher;
import net.minecraft.world.level.gameevent.GameEventDispatcher;
@@ -608,6 +610,10 @@ public class LevelChunk implements ChunkAccess {
2021-06-11 14:02:28 +02:00
}
// CraftBukkit start
+ // Paper start - Remove invalid mob spawner tile entities
2021-06-12 00:37:16 +02:00
+ } else if (blockEntity instanceof SpawnerBlockEntity && !(getBlockState(blockposition).getBlock() instanceof SpawnerBlock)) {
2021-06-12 08:02:49 +02:00
+ this.removeBlockEntity(blockEntity.getBlockPos());
2021-06-11 14:02:28 +02:00
+ // Paper end
} else {
System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
2021-06-12 00:37:16 +02:00
+ " (" + this.getBlockState(blockposition) + ") where there was no entity tile!");