2020-05-06 11:48:49 +02:00
|
|
|
From 0000000000000000000000000000000000000000 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
|
2020-06-30 07:20:29 +02:00
|
|
|
index 912f5be0264b604df175f5825765b03b319a841c..2dfc881894753469080a5038c770e126cb19a806 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
|
2020-06-26 03:58:00 +02:00
|
|
|
@@ -188,6 +188,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-02-21 18:52:20 +01:00
|
|
|
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
2017-07-09 08:38:30 +02:00
|
|
|
public final boolean defaultActivationState;
|
|
|
|
public long activatedTick = Integer.MIN_VALUE;
|
|
|
|
+ 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
|
2020-06-26 03:58:00 +02:00
|
|
|
@@ -1582,6 +1583,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) {
|
2020-06-26 03:58:00 +02:00
|
|
|
@@ -1704,6 +1709,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2017-07-09 08:38:30 +02:00
|
|
|
if (!originTag.isEmpty()) {
|
2020-06-26 08:29:44 +02:00
|
|
|
origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
2017-07-09 08:38:30 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ 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
|
2020-06-25 15:11:48 +02:00
|
|
|
index 2b7f020e00fc1ea456d0155e7e383969aee318b7..5fda5be52ee7dbf29ac791d0f49326dd74ff2d08 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
|
2020-02-21 18:52:20 +01:00
|
|
|
@@ -140,6 +140,7 @@ public abstract class MobSpawnerAbstract {
|
2019-04-28 01:23:53 +02:00
|
|
|
}
|
2020-02-21 18:52:20 +01:00
|
|
|
// Spigot End
|
2017-07-09 08:38:30 +02:00
|
|
|
}
|
|
|
|
+ entity.spawnedViaMobSpawner = true; // Paper
|
|
|
|
// Spigot Start
|
2020-02-21 18:52:20 +01:00
|
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
|
|
|
|
Entity vehicle = entity.getVehicle();
|
2017-07-09 08:38:30 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2020-06-25 15:11:48 +02:00
|
|
|
index 613081685e233074728366b9ff16642c04774c91..66edc6ae67084959503ffa0df2c04174fb29b8d8 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
|
2020-06-25 15:11:48 +02:00
|
|
|
@@ -1054,5 +1054,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
|
|
|
|
}
|