2020-05-06 09:48:49 +00:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
2017-07-09 06:38:30 +00: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
|
2021-02-21 19:45:33 +00:00
|
|
|
index bb049690ce61310a90852637397abd449c1dc43a..3b134ea0a6b30dce70ed9d00414c305354e07476 100644
|
2017-07-09 06:38:30 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/Entity.java
|
2020-09-19 11:29:53 +00:00
|
|
|
@@ -183,6 +183,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2020-02-21 17:52:20 +00:00
|
|
|
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
2017-07-09 06:38:30 +00: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-11-03 02:22:15 +00:00
|
|
|
@@ -1580,6 +1581,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2019-05-06 02:58:04 +00:00
|
|
|
if (this.origin != null) {
|
2017-07-09 06:38:30 +00: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-11-03 02:22:15 +00:00
|
|
|
@@ -1708,6 +1713,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
2017-07-09 06:38:30 +00:00
|
|
|
if (!originTag.isEmpty()) {
|
2020-06-26 06:29:44 +00:00
|
|
|
origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
2017-07-09 06:38:30 +00: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-08-25 02:22:08 +00:00
|
|
|
index 259713339217660e8b81a9500f57c6995ea59dde..8eb20c6b9a88d5d4056f91df1f496d3d35b473da 100644
|
2017-07-09 06:38:30 +00:00
|
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
|
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
|
2020-08-25 02:22:08 +00:00
|
|
|
@@ -143,6 +143,7 @@ public abstract class MobSpawnerAbstract {
|
|
|
|
}
|
|
|
|
// Spigot End
|
2019-04-27 23:23:53 +00:00
|
|
|
}
|
2017-07-09 06:38:30 +00:00
|
|
|
+ entity.spawnedViaMobSpawner = true; // Paper
|
2020-08-25 02:22:08 +00:00
|
|
|
// Spigot Start
|
|
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
|
|
|
|
Entity vehicle = entity.getVehicle();
|
2017-07-09 06:38:30 +00:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2021-02-21 19:45:33 +00:00
|
|
|
index 14c06298157c4a6c6061df01b213e69b6c3481d5..976dbe680ef56095071b0416d5e1f0d68cf546e6 100644
|
2017-07-09 06:38:30 +00:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2021-02-21 19:45:33 +00:00
|
|
|
@@ -1101,5 +1101,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2017-07-09 06:38:30 +00:00
|
|
|
Location origin = getHandle().origin;
|
|
|
|
return origin == null ? null : origin.clone();
|
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean fromMobSpawner() {
|
|
|
|
+ return getHandle().spawnedViaMobSpawner;
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|