geforkt von Mirrors/Paper
make EntityPortalReadyEvent#setTargetWorld work again
Dieser Commit ist enthalten in:
Ursprung
1862266320
Commit
a9fdf73f2e
@ -37,7 +37,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ private static final HandlerList HANDLER_LIST = new HandlerList();
|
||||
+
|
||||
+ private final PortalType portalType;
|
||||
+ private final World targetWorld;
|
||||
+ private World targetWorld;
|
||||
+
|
||||
+ private boolean cancelled;
|
||||
+
|
||||
@ -71,11 +71,9 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
|
||||
+ * or {@link EntityPortalEvent}.
|
||||
+ *
|
||||
+ * @param targetWorld the world
|
||||
+ * @deprecated changing the target world has no effect
|
||||
+ */
|
||||
+ @Deprecated(forRemoval = true, since = "1.21")
|
||||
+ public void setTargetWorld(final @Nullable World targetWorld) {
|
||||
+ // this.targetWorld = targetWorld;
|
||||
+ this.targetWorld = targetWorld;
|
||||
+ }
|
||||
+
|
||||
+ /**
|
||||
|
@ -4,25 +4,22 @@ Date: Wed, 12 May 2021 04:30:42 -0700
|
||||
Subject: [PATCH] Add EntityPortalReadyEvent
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
diff --git a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess
|
||||
if (this.portalProcess != null) {
|
||||
if (this.portalProcess.processPortalTeleportation(worldserver, this, this.canUsePortal(false))) {
|
||||
worldserver.getProfiler().push("portal");
|
||||
+ // Paper start - Add EntityPortalReadyEvent
|
||||
+ ServerLevel changedTarget = worldserver.getServer().getLevel(worldserver.getTypeKey() == net.minecraft.world.level.dimension.LevelStem.NETHER ? Level.OVERWORLD : Level.NETHER);
|
||||
+ if (this.portalProcess.isSamePortal(((net.minecraft.world.level.block.NetherPortalBlock) net.minecraft.world.level.block.Blocks.NETHER_PORTAL))) {
|
||||
+ io.papermc.paper.event.entity.EntityPortalReadyEvent event = new io.papermc.paper.event.entity.EntityPortalReadyEvent(this.getBukkitEntity(), changedTarget == null ? null : changedTarget.getWorld(), org.bukkit.PortalType.NETHER);
|
||||
+ if (!event.callEvent()) {
|
||||
+ this.portalProcess = null;
|
||||
+ worldserver.getProfiler().pop();
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end - Add EntityPortalReadyEvent
|
||||
this.setPortalCooldown();
|
||||
DimensionTransition dimensiontransition = this.portalProcess.getPortalDestination(worldserver, this);
|
||||
--- a/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
+++ b/src/main/java/net/minecraft/world/level/block/NetherPortalBlock.java
|
||||
@@ -0,0 +0,0 @@ public class NetherPortalBlock extends Block implements Portal {
|
||||
// CraftBukkit start
|
||||
ResourceKey<Level> resourcekey = world.getTypeKey() == LevelStem.NETHER ? Level.OVERWORLD : Level.NETHER;
|
||||
ServerLevel worldserver1 = world.getServer().getLevel(resourcekey);
|
||||
+ // Paper start - Add EntityPortalReadyEvent
|
||||
+ io.papermc.paper.event.entity.EntityPortalReadyEvent portalReadyEvent = new io.papermc.paper.event.entity.EntityPortalReadyEvent(entity.getBukkitEntity(), worldserver1 == null ? null : worldserver1.getWorld(), org.bukkit.PortalType.NETHER);
|
||||
+ if (!portalReadyEvent.callEvent()) {
|
||||
+ entity.portalProcess = null;
|
||||
+ return null;
|
||||
+ }
|
||||
+ worldserver1 = portalReadyEvent.getTargetWorld() == null ? null : ((org.bukkit.craftbukkit.CraftWorld) portalReadyEvent.getTargetWorld()).getHandle();
|
||||
+ // Paper end - Add EntityPortalReadyEvent
|
||||
|
||||
if (worldserver1 == null) {
|
||||
return new DimensionTransition(PlayerTeleportEvent.TeleportCause.NETHER_PORTAL); // always fire event in case plugins wish to change it
|
||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren