2019-12-16 03:58:10 +01:00
|
|
|
From 320aa57d604f28bc1f678be85099222483c4dba7 Mon Sep 17 00:00:00 2001
|
2017-07-09 08:38:30 +02:00
|
|
|
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
|
2019-12-16 03:58:10 +01:00
|
|
|
index fcfe8f550d..7c4ab7fe72 100644
|
2017-07-09 08:38:30 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2019-12-12 00:43:22 +01:00
|
|
|
@@ -189,6 +189,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2017-07-09 08:38:30 +02:00
|
|
|
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
|
2019-12-12 00:43:22 +01:00
|
|
|
@@ -1621,6 +1622,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2019-05-06 04:58:04 +02:00
|
|
|
if (this.origin != null) {
|
2017-07-09 08:38:30 +02:00
|
|
|
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) {
|
2019-12-12 00:43:22 +01:00
|
|
|
@@ -1741,6 +1746,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2017-07-09 08:38:30 +02:00
|
|
|
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
|
2019-12-16 03:58:10 +01:00
|
|
|
index deb32db2b2..8384a2cbf8 100644
|
2017-07-09 08:38:30 +02:00
|
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
2019-12-12 00:43:22 +01:00
|
|
|
@@ -134,6 +134,7 @@ public abstract class MobSpawnerAbstract {
|
2019-04-28 01:23:53 +02:00
|
|
|
((EntityInsentient) entity).prepare(world, world.getDamageScaler(new BlockPosition(entity)), EnumMobSpawn.SPAWNER, (GroupDataEntity) null, (NBTTagCompound) null);
|
|
|
|
}
|
2017-07-09 08:38:30 +02:00
|
|
|
}
|
|
|
|
+ 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
|
2019-12-16 03:58:10 +01:00
|
|
|
index bb07dec3c8..495a7c464f 100644
|
2017-07-09 08:38:30 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2019-12-12 00:43:22 +01:00
|
|
|
@@ -1045,5 +1045,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2017-07-09 08:38:30 +02:00
|
|
|
Location origin = getHandle().origin;
|
|
|
|
return origin == null ? null : origin.clone();
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean fromMobSpawner() {
|
|
|
|
+ return getHandle().spawnedViaMobSpawner;
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
--
|
2019-12-16 03:58:10 +01:00
|
|
|
2.24.1
|
2017-07-09 08:38:30 +02:00
|
|
|
|