2020-05-06 17:48:49 +08:00
|
|
|
From 0000000000000000000000000000000000000000 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()
|
|
|
|
|
|
|
|
|
2021-03-16 15:19:45 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
index b798190628c1d83b5bf9e5497b515ef1e9f26707..6b6de18e368d48b61482a7210794b756d805a460 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
@@ -268,6 +268,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2020-02-22 01:52:20 +08:00
|
|
|
public final org.spigotmc.ActivationRange.ActivationType activationType = org.spigotmc.ActivationRange.initializeEntityActivationType(this);
|
2017-07-09 14:38:30 +08: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
|
2021-03-16 15:19:45 +08:00
|
|
|
@@ -1665,6 +1666,10 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2019-05-06 10:58:04 +08:00
|
|
|
if (this.origin != null) {
|
2017-07-09 14:38:30 +08: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) {
|
2021-03-16 15:19:45 +08:00
|
|
|
@@ -1793,6 +1798,8 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
|
2017-07-09 14:38:30 +08:00
|
|
|
if (!originTag.isEmpty()) {
|
2020-06-26 14:29:44 +08:00
|
|
|
origin = new org.bukkit.Location(world.getWorld(), originTag.getDoubleAt(0), originTag.getDoubleAt(1), originTag.getDoubleAt(2));
|
2017-07-09 14:38:30 +08:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ spawnedViaMobSpawner = nbttagcompound.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
|
|
|
// Paper end
|
|
|
|
|
|
|
|
} catch (Throwable throwable) {
|
2021-03-16 15:19:45 +08:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
|
|
|
index 76c98d576d3e567ec4482b30219f5a9107cb9703..43fcc001bb9815b352cb74af10290b2a4ccaa540 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/MobSpawnerAbstract.java
|
|
|
|
@@ -160,6 +160,7 @@ public abstract class MobSpawnerAbstract {
|
2020-08-25 10:22:08 +08:00
|
|
|
}
|
|
|
|
// Spigot End
|
2019-04-28 07:23:53 +08:00
|
|
|
}
|
2017-07-09 14:38:30 +08:00
|
|
|
+ entity.spawnedViaMobSpawner = true; // Paper
|
2020-08-25 10:22:08 +08:00
|
|
|
// Spigot Start
|
|
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, blockposition).isCancelled()) {
|
|
|
|
Entity vehicle = entity.getVehicle();
|
2017-07-09 14:38:30 +08:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2021-03-16 15:19:45 +08:00
|
|
|
index a58626b1a0160983a738a45c8a1d411eb347e6a2..4c2a35fb33da19a15a220dc5e0c9fa3233d657fb 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
|
2021-03-16 15:19:45 +08:00
|
|
|
@@ -1100,5 +1100,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
|
|
|
|
}
|