2021-06-11 14:02:28 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
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/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
2024-01-23 15:43:48 +01:00
|
|
|
index 784ab316b6346f62519b06b0dadafa6ac75d8737..42f8c39fa5f9f31c03d4e7af9fb6b7a842f29aae 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
2024-01-14 10:46:04 +01:00
|
|
|
@@ -395,6 +395,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
2021-06-11 14:02:28 +02:00
|
|
|
// Spigot end
|
2021-12-03 22:28:15 +01:00
|
|
|
// Paper start
|
2024-01-22 19:01:10 +01:00
|
|
|
protected int numCollisions = 0; // Paper - Cap entity collisions
|
2021-12-03 22:28:15 +01:00
|
|
|
+ public boolean spawnedViaMobSpawner; // Paper - Yes this name is similar to above, upstream took the better one
|
|
|
|
@javax.annotation.Nullable
|
|
|
|
private org.bukkit.util.Vector origin;
|
|
|
|
@javax.annotation.Nullable
|
2024-01-14 10:46:04 +01:00
|
|
|
@@ -2202,6 +2203,10 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
2021-06-22 12:54:49 +02:00
|
|
|
}
|
2023-12-05 23:12:48 +01:00
|
|
|
nbttagcompound.put("Paper.Origin", this.newDoubleList(origin.getX(), origin.getY(), origin.getZ()));
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+ // Save entity's from mob spawner status
|
|
|
|
+ if (spawnedViaMobSpawner) {
|
2023-12-06 19:36:49 +01:00
|
|
|
+ nbttagcompound.putBoolean("Paper.FromMobSpawner", true);
|
2021-06-11 14:02:28 +02:00
|
|
|
+ }
|
|
|
|
// Paper end
|
2023-12-05 23:12:48 +01:00
|
|
|
return nbttagcompound;
|
2021-06-11 14:02:28 +02:00
|
|
|
} catch (Throwable throwable) {
|
2024-01-14 10:46:04 +01:00
|
|
|
@@ -2342,6 +2347,8 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, S
|
2021-06-16 07:36:02 +02:00
|
|
|
this.originWorld = originWorld;
|
2021-06-17 19:11:00 +02:00
|
|
|
origin = new org.bukkit.util.Vector(originTag.getDouble(0), originTag.getDouble(1), originTag.getDouble(2));
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
2021-06-12 13:18:01 +02:00
|
|
|
+ spawnedViaMobSpawner = nbt.getBoolean("Paper.FromMobSpawner"); // Restore entity's from mob spawner status
|
2021-06-11 14:02:28 +02:00
|
|
|
// Paper end
|
|
|
|
|
|
|
|
} catch (Throwable throwable) {
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/BaseSpawner.java b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
2023-12-05 23:12:48 +01:00
|
|
|
index bd48f49d50709354abc5bcff155b5abb9ab20191..1a5fb001e28997a113ad8133e9dc946206b85c35 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/BaseSpawner.java
|
2023-12-05 23:12:48 +01:00
|
|
|
@@ -167,6 +167,7 @@ public abstract class BaseSpawner {
|
2021-06-12 14:09:11 +02:00
|
|
|
// Spigot End
|
|
|
|
}
|
2023-06-13 01:51:45 +02:00
|
|
|
|
2021-06-12 14:09:11 +02:00
|
|
|
+ entity.spawnedViaMobSpawner = true; // Paper
|
2023-06-13 01:51:45 +02:00
|
|
|
// CraftBukkit start
|
2021-06-12 14:09:11 +02:00
|
|
|
if (org.bukkit.craftbukkit.event.CraftEventFactory.callSpawnerSpawnEvent(entity, pos).isCancelled()) {
|
2023-06-13 01:51:45 +02:00
|
|
|
continue;
|
2021-06-11 14:02:28 +02:00
|
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
2024-01-14 10:46:04 +01:00
|
|
|
index 74937603e7b8308fd314d650d9d966e8abd2c725..deb355b2188a49f818aaddad6c4ce60de94428e0 100644
|
2021-06-11 14:02:28 +02:00
|
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
|
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
|
Updated Upstream (Bukkit/CraftBukkit) (#10034)
Upstream has released updates that appear to apply and compile correctly.
This update has not been tested by PaperMC and as with ANY update, please do your own testing
Bukkit Changes:
f29cb801 Separate checkstyle-suppressions file is not required
86f99bbe SPIGOT-7540, PR-946: Add ServerTickManager API
d4119585 SPIGOT-6903, PR-945: Add BlockData#getMapColor
b7a2ed41 SPIGOT-7530, PR-947: Add Player#removeResourcePack
9dd56255 SPIGOT-7527, PR-944: Add WindCharge#explode()
994a6163 Attempt upgrade of resolver libraries
CraftBukkit Changes:
b3b43a6ad Add Checkstyle check for unused imports
13fb3358e SPIGOT-7544: Scoreboard#getEntries() doesn't get entries but class names
3dda99c06 SPIGOT-7540, PR-1312: Add ServerTickManager API
2ab4508c0 SPIGOT-6903, PR-1311: Add BlockData#getMapColor
1dbdbbed4 PR-1238: Remove unnecessary sign ticking
659728d2a MC-264285, SPIGOT-7439, PR-1237: Fix unbreakable flint and steel is completely consumed while igniting creeper
e37e29ce0 Increase outdated build delay
c00438b39 SPIGOT-7530, PR-1313: Add Player#removeResourcePack
492dd80ce SPIGOT-7527, PR-1310: Add WindCharge#explode()
e11fbb9d7 Upgrade MySQL driver
9f3a0bd2a Attempt upgrade of resolver libraries
60d16d7ca PR-1306: Centralize Bukkit and Minecraft entity conversion
Spigot Changes:
06d602e7 Rebuild patches
2023-12-17 03:09:28 +01:00
|
|
|
@@ -1012,5 +1012,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
|
2021-06-16 07:36:02 +02:00
|
|
|
//noinspection ConstantConditions
|
|
|
|
return originVector.toLocation(world);
|
2021-06-11 14:02:28 +02:00
|
|
|
}
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public boolean fromMobSpawner() {
|
|
|
|
+ return getHandle().spawnedViaMobSpawner;
|
|
|
|
+ }
|
|
|
|
// Paper end
|
|
|
|
}
|