3
0
Mirror von https://github.com/PaperMC/Paper.git synchronisiert 2024-11-15 12:30:06 +01:00
Paper/Spigot-Server-Patches/0219-Entity-fromMobSpawner.patch

69 Zeilen
3.3 KiB
Diff

2017-10-05 15:38:21 +02:00
From f18fa9055375d8a2c362a4a0f41ac414fe424279 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/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
2017-08-09 20:44:28 +02:00
index d744477c9..18eee4944 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -169,6 +169,7 @@ public abstract class Entity implements ICommandListener {
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
@@ -1584,6 +1585,10 @@ public abstract class Entity implements ICommandListener {
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) {
@@ -1734,6 +1739,8 @@ public abstract class Entity implements ICommandListener {
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
2017-08-09 20:44:28 +02:00
index 0562c6e34..06b064a78 100644
--- a/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
+++ b/src/main/java/net/minecraft/server/MobSpawnerAbstract.java
2017-08-09 20:44:28 +02:00
@@ -107,6 +107,7 @@ public abstract class MobSpawnerAbstract {
if (this.spawnData.b().d() == 1 && this.spawnData.b().hasKeyOfType("id", 8) && entity instanceof EntityInsentient) {
((EntityInsentient) entity).prepare(world.D(new BlockPosition(entity)), (GroupDataEntity) null);
}
+ 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
2017-10-05 15:38:21 +02:00
index 9429ae1ab..248477661 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -788,5 +788,10 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
Location origin = getHandle().origin;
return origin == null ? null : origin.clone();
}
+
+ @Override
+ public boolean fromMobSpawner() {
+ return getHandle().spawnedViaMobSpawner;
+ }
// Paper end
}
--
2017-10-05 15:38:21 +02:00
2.14.2