aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0021-Remove-invalid-mob-spawner-tile-entities.patch
blob: f2a68ad13fad00caeb1a8e3246c25d59b69274af (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
From 1f32bbad70c29f4636c376fa8dac5e579e3e4865 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Sun, 8 Mar 2015 22:55:25 -0600
Subject: [PATCH] Remove invalid mob spawner tile entities


diff --git a/src/main/java/net/minecraft/server/Chunk.java b/src/main/java/net/minecraft/server/Chunk.java
index 022ba31..7242d45 100644
--- a/src/main/java/net/minecraft/server/Chunk.java
+++ b/src/main/java/net/minecraft/server/Chunk.java
@@ -784,6 +784,11 @@ public class Chunk {
             tileentity.D();
             this.tileEntities.put(blockposition, tileentity);
             // CraftBukkit start
+            // PaperSpigot start - Remove invalid mob spawner tile entities
+        } else if (this.world.paperSpigotConfig.removeInvalidMobSpawnerTEs && tileentity instanceof TileEntityMobSpawner &&
+                org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) != org.bukkit.Material.MOB_SPAWNER) {
+            this.tileEntities.remove(blockposition);
+            // PaperSpigot end
         } else {
             System.out.println("Attempted to place a tile entity (" + tileentity + ") at " + tileentity.position.getX() + "," + tileentity.position.getY() + "," + tileentity.position.getZ()
                 + " (" + org.bukkit.craftbukkit.util.CraftMagicNumbers.getMaterial(getType(blockposition)) + ") where there was no entity tile!");
diff --git a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
index 781cf75..af53220 100644
--- a/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
+++ b/src/main/java/org/github/paperspigot/PaperSpigotWorldConfig.java
@@ -173,4 +173,11 @@ public class PaperSpigotWorldConfig
         waterOverLavaFlowSpeed = getInt( "water-over-lava-flow-speed", 5 );
         log( "Water over lava flow speed: " + waterOverLavaFlowSpeed );
     }
+
+    public boolean removeInvalidMobSpawnerTEs;
+    private void removeInvalidMobSpawnerTEs()
+    {
+        removeInvalidMobSpawnerTEs = getBoolean( "remove-invalid-mob-spawner-tile-entities", true );
+        log( "Remove invalid mob spawner tile entities: " + removeInvalidMobSpawnerTEs );
+    }
 }
-- 
2.7.0