51cfcc88da
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: d352d965 SPIGOT-7221: Add Enemy (Entity) interface CraftBukkit Changes: 397c5557c SPIGOT-7221: Add Enemy (Entity) interface a0d3dfaf2 PR-1129: Fix state corruption while handling explosion damage on EntityComplexPart d67777f8b SPIGOT-7218: Player's outer layer of skin disappears after respawn
98 Zeilen
5.1 KiB
Diff
98 Zeilen
5.1 KiB
Diff
From 0000000000000000000000000000000000000000 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/world/entity/monster/Phantom.java b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
index c068eddb08898681735e483df5b9c36f5fef3878..0e96e9d7e4d636f4222f60cec556663f506c3906 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/monster/Phantom.java
|
|
@@ -171,6 +171,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
}
|
|
|
|
this.setPhantomSize(nbt.getInt("Size"));
|
|
+ // Paper start
|
|
+ if (nbt.hasUUID("Paper.SpawningEntity")) {
|
|
+ this.spawningEntity = nbt.getUUID("Paper.SpawningEntity");
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|
|
@@ -180,6 +185,11 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
nbt.putInt("AY", this.anchorPoint.getY());
|
|
nbt.putInt("AZ", this.anchorPoint.getZ());
|
|
nbt.putInt("Size", this.getPhantomSize());
|
|
+ // Paper start
|
|
+ if (this.spawningEntity != null) {
|
|
+ nbt.putUUID("Paper.SpawningEntity", this.spawningEntity);
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
@Override
|
|
@@ -231,6 +241,14 @@ public class Phantom extends FlyingMob implements Enemy {
|
|
return entitysize.scale(f);
|
|
}
|
|
|
|
+ // Paper start
|
|
+ java.util.UUID spawningEntity;
|
|
+
|
|
+ public java.util.UUID getSpawningEntity() {
|
|
+ return spawningEntity;
|
|
+ }
|
|
+ public void setSpawningEntity(java.util.UUID entity) { this.spawningEntity = entity; }
|
|
+ // Paper end
|
|
private static enum AttackPhase {
|
|
|
|
CIRCLE, SWOOP;
|
|
diff --git a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
|
index 42d88ce2e15477482a814a79aefd4abfcbcb5462..900a66fc7eb817509df904b71ccc3bd3976f3b35 100644
|
|
--- a/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
|
+++ b/src/main/java/net/minecraft/world/level/levelgen/PhantomSpawner.java
|
|
@@ -3,6 +3,7 @@ package net.minecraft.world.level.levelgen;
|
|
import java.util.Iterator;
|
|
import net.minecraft.core.BlockPos;
|
|
import net.minecraft.nbt.CompoundTag;
|
|
+import io.papermc.paper.util.MCUtil;
|
|
import net.minecraft.server.level.ServerLevel;
|
|
import net.minecraft.server.level.ServerPlayer;
|
|
import net.minecraft.stats.ServerStatsCounter;
|
|
@@ -71,9 +72,19 @@ public class PhantomSpawner implements CustomSpawner {
|
|
int k = 1 + randomsource.nextInt(difficultydamagescaler.getDifficulty().getId() + 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), ((ServerPlayer) entityhuman).getBukkitEntity(), org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.NATURAL);
|
|
+ if (!event.callEvent()) {
|
|
+ if (event.shouldAbortSpawn()) {
|
|
+ break;
|
|
+ }
|
|
+ continue;
|
|
+ }
|
|
+ // Paper end
|
|
Phantom entityphantom = (Phantom) EntityType.PHANTOM.create(world);
|
|
|
|
if (entityphantom != null) {
|
|
+ entityphantom.setSpawningEntity(entityhuman.getUUID()); // Paper
|
|
entityphantom.moveTo(blockposition1, 0.0F, 0.0F);
|
|
groupdataentity = entityphantom.finalizeSpawn(world, difficultydamagescaler, MobSpawnType.NATURAL, groupdataentity, (CompoundTag) null);
|
|
world.addFreshEntityWithPassengers(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 ac43323a391c380458e741ba8a809c02f8b2903c..1ebb83fe98f573d0a982397096d4dba7249aef4b 100644
|
|
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPhantom.java
|
|
@@ -34,4 +34,11 @@ public class CraftPhantom extends CraftFlying implements Phantom, CraftEnemy {
|
|
public EntityType getType() {
|
|
return EntityType.PHANTOM;
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ @Override
|
|
+ public java.util.UUID getSpawningEntity() {
|
|
+ return getHandle().getSpawningEntity();
|
|
+ }
|
|
+ // Paper end
|
|
}
|