Paper/Spigot-Server-Patches/0188-Entity-fromMobSpawner.patch
Shane Freeder 54dd19b818
Updated Upstream (Bukkit/CraftBukkit)
Upstream has released updates that appears to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing

Bukkit Changes:
18cda936 Fix variant of unloadChunkRequest that was incorrectly never deprecated
00763e1b Deprecate some methods
35a83d54 SPIGOT-4572: Make default no permission message clearer
6163343d Fix some misplaced material enum entries
8736469c Fix typo in TechnicalPiston documentation

CraftBukkit Changes:
0c715b32 SPIGOT-4579: Shulker boxes not dropping in creative
50fbc3f1 SPIGOT-4576: Fix attributes in itemstack internal data being lost
8059a937 SPIGOT-4577: Fix loss of int/double custom tags when serialized to yaml
07e504c3 Clarify exception thrown when setting drop chance for player inventory
98b862ad Fix duplicate iron golem add
843cee65 Fix a bunch of duplicate EntityCombustEvent calls
43855624 SPIGOT-4571: EntityCombustEvent not firing for phantoms
2019-01-15 21:12:19 +00:00

69 lines
3.4 KiB
Diff

From a15e970ed18cc79400d6dbbcdcf1d95d5ff86582 Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Sun, 18 Jun 2017 18:17:05 -0500
Subject: [PATCH] Entity#fromMobSpawner()
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 4be9226c8e..e64d032b7f 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -182,6 +182,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
public final boolean defaultActivationState;
public long activatedTick = Integer.MIN_VALUE;
public boolean fromMobSpawner;
+ public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
protected int numCollisions = 0; // Paper
public void inactiveTick() { }
// Spigot end
@@ -1664,6 +1665,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (origin != null) {
nbttagcompound.set("Paper.Origin", this.createList(origin.getX(), origin.getY(), origin.getZ()));
}
+ // Save entity's from mob spawner status
+ if (spawnedViaMobSpawner) {
+ nbttagcompound.setBoolean("Paper.FromMobSpawner", true);
+ }
// Paper end
return nbttagcompound;
} catch (Throwable throwable) {
@@ -1811,6 +1816,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
if (!originTag.isEmpty()) {
origin = new Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
}
+
+ spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
// Paper end
} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
index ce43b4bc52..98065d6b02 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
@@ -115,6 +115,7 @@ public abstract class MobSpawnerAbstract {
if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) {
((EntityInsentient) entity).prepare(world.getDamageScaler(new BlockPosition(entity)), (GroupDataEntity) null, (NBTTagCompound) null);
}
+ entity.spawnedViaMobSpawner = true; // Paper
// Spigot Start
if ( entity.world.spigotConfig.nerfSpawnerMobs )
{
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index a82717f5c1..67530ba0fc 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -839,5 +839,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Location origin = getHandle().origin;
return origin == null ? null : origin.clone();
}
+
+ @Override
+ public boolean fromMobSpawner() {
+ return getHandle().spawnedViaMobSpawner;
+ }
// Paper end
}
--
2.20.1