aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/removed/1.18.2/0025-Remove-invalid-mob-spawner-tile-entities.patch
blob: 7a4832a9013e72f8d6429c8d47cb16d37fb7e04b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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

Minecraft checks if the block is able to hold a tile entity higher up, preventing them from ever
being added to the world.

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 5496c9ae4af9658164098356532da47351808b51..2ca41f90b6b50c254a6e34da00f287197c81d65e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
+++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunk.java
@@ -543,6 +543,11 @@ public class LevelChunk extends ChunkAccess {
             }
 
             // CraftBukkit start
+            // Paper start - Remove invalid mob spawner tile entities
+        } else if (blockEntity instanceof net.minecraft.world.level.block.entity.SpawnerBlockEntity
+            && !(getBlockState(blockposition).getBlock() instanceof net.minecraft.world.level.block.SpawnerBlock)) {
+            this.removeBlockEntity(blockEntity.getBlockPos());
+            // Paper end
         } else {
             System.out.println("Attempted to place a tile entity (" + blockEntity + ") at " + blockEntity.getBlockPos().getX() + "," + blockEntity.getBlockPos().getY() + "," + blockEntity.getBlockPos().getZ()
                 + " (" + this.getBlockState(blockposition) + ") where there was no entity tile!");