2018-07-23 16:39:55 +08:00
|
|
|
From 6947e3fbbe3d9138b66a298d2b5f5f68c810d7d8 Mon Sep 17 00:00:00 2001
|
2017-07-09 14:38:30 +08: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
|
2018-07-23 16:39:55 +08:00
|
|
|
index 6db20aa75c..bd232b31e4 100644
|
2017-07-09 14:38:30 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2018-07-22 04:43:00 +08:00
|
|
|
@@ -181,6 +181,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2017-07-09 14:38:30 +08: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
|
2018-07-22 04:43:00 +08:00
|
|
|
@@ -1671,6 +1672,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2017-07-09 14:38:30 +08:00
|
|
|
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) {
|
2018-07-22 04:43:00 +08:00
|
|
|
@@ -1819,6 +1824,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2017-07-09 14:38:30 +08: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
|
2018-07-23 16:39:55 +08:00
|
|
|
index 61472a0eb2..2b6b062c61 100644
|
2017-07-09 14:38:30 +08:00
|
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
2018-07-18 08:08:13 +08:00
|
|
|
@@ -115,6 +115,7 @@ public abstract class MobSpawnerAbstract {
|
2017-07-09 14:38:30 +08:00
|
|
|
if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) {
|
2018-07-18 08:08:13 +08:00
|
|
|
((EntityInsentient) entity).prepare(world.getDamageScaler(new BlockPosition(entity)), (GroupDataEntity) null, (NBTTagCompound) null);
|
2017-07-09 14:38:30 +08: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
|
2018-07-23 16:39:55 +08:00
|
|
|
index 03a3328b06..6d4dc539cb 100644
|
2017-07-09 14:38:30 +08:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2018-07-18 08:08:13 +08:00
|
|
|
@@ -816,5 +816,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2017-07-09 14:38:30 +08:00
|
|
|
Location origin = getHandle().origin;
|
|
|
|
return origin == null ? null : origin.clone();
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean fromMobSpawner() {
|
|
|
|
+ return getHandle().spawnedViaMobSpawner;
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|
|
|
|
--
|
2018-07-04 15:55:24 +08:00
|
|
|
2.18.0
|
2017-07-09 14:38:30 +08:00
|
|
|
|