geforkt von Mirrors/Paper
1e38743b1d
Also fixes build as a result of an upstream force push --- work/Bukkit Submodule work/Bukkit 217dc08d..d13fdf8c: > SPIGOT-4637: Add source block to BlockPhysicsEvent. --- work/CraftBukkit Submodule work/CraftBukkit acbba8ba..cb98c6ea: > Fix line endings in CraftDefaultPermissions > SPIGOT-4637: Add source block to BlockPhysicsEvent. --- work/Spigot Submodule work/Spigot 75ee78a0c...4165cd8f4 (commits not present) > (Manually Added) - Appears to be a result of an upstream force push > (Manually Added) - Changed: SPIGOT-4636: Add creative mode NBT permissions
91 Zeilen
4.3 KiB
Diff
91 Zeilen
4.3 KiB
Diff
From d1aba7bb16817353cd0be79f16f7e8596eb5fe94 Mon Sep 17 00:00:00 2001
|
|
From: BillyGalbreath <Blake.Galbreath@GMail.com>
|
|
Date: Sat, 25 Aug 2018 19:56:51 -0500
|
|
Subject: [PATCH] Add PhantomPreSpawnEvent
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/EntityPhantom.java b/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
index a99d90efc..f576264a8 100644
|
|
--- a/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
+++ b/src/main/java/net/minecraft/server/EntityPhantom.java
|
|
@@ -127,6 +127,11 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
}
|
|
|
|
this.setSize(nbttagcompound.getInt("Size"));
|
|
+ // Paper start
|
|
+ if (nbttagcompound.hasUUID("Paper.SpawningEntity")) {
|
|
+ this.spawningEntity = nbttagcompound.getUUID("Paper.SpawningEntity");
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
public void b(NBTTagCompound nbttagcompound) {
|
|
@@ -135,6 +140,11 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
nbttagcompound.setInt("AY", this.c.getY());
|
|
nbttagcompound.setInt("AZ", this.c.getZ());
|
|
nbttagcompound.setInt("Size", this.getSize());
|
|
+ // Paper start
|
|
+ if (this.spawningEntity != null) {
|
|
+ nbttagcompound.setUUID("Paper.SpawningEntity", this.spawningEntity);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
public SoundCategory bV() {
|
|
@@ -170,6 +180,14 @@ public class EntityPhantom extends EntityFlying implements IMonster {
|
|
return true;
|
|
}
|
|
|
|
+ // Paper start
|
|
+ java.util.UUID spawningEntity;
|
|
+
|
|
+ public java.util.UUID getSpawningEntity() {
|
|
+ return spawningEntity;
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
class b extends PathfinderGoal {
|
|
|
|
private int b;
|
|
diff --git a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
|
|
index 5c43d908f..5ddf66eef 100644
|
|
--- a/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
|
|
+++ b/src/main/java/net/minecraft/server/MobSpawnerPhantom.java
|
|
@@ -50,8 +50,17 @@ public class MobSpawnerPhantom {
|
|
int k = 1 + random.nextInt(difficultydamagescaler.a().a() + 1);
|
|
|
|
for (int l = 0; l < k; ++l) {
|
|
+ // Paper start
|
|
+ com.destroystokyo.paper.event.entity.PhantomPreSpawnEvent event = new com.destroystokyo.paper.event.entity.PhantomPreSpawnEvent(MCUtil.toLocation(world, blockposition1), ((EntityPlayer) entityhuman).getBukkitEntity(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL);
|
|
+ if (!event.callEvent()) {
|
|
+ if (event.shouldAbortSpawn()) {
|
|
+ break;
|
|
+ }
|
|
+ continue;
|
|
+ }
|
|
+ // Paper end
|
|
EntityPhantom entityphantom = new EntityPhantom(world);
|
|
-
|
|
+ entityphantom.spawningEntity = entityhuman.uniqueID; // Paper
|
|
entityphantom.setPositionRotation(blockposition1, 0.0F, 0.0F);
|
|
groupdataentity = entityphantom.prepare(difficultydamagescaler, groupdataentity, (NBTTagCompound) null);
|
|
world.addEntity(entityphantom, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL); // CraftBukkit
|
|
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
index 9f9ee9239..2b9731369 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
@@ -35,4 +35,10 @@ public class CraftPhantom extends CraftFlying implements Phantom {
|
|
public EntityType getType() {
|
|
return EntityType.PHANTOM;
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ public java.util.UUID getSpawningEntity() {
|
|
+ return getHandle().getSpawningEntity();
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
--
|
|
2.20.1
|
|
|