Use correct update flag and blockdata for portals

Fixes GH-1286
This commit is contained in:
Zach Brown 2018-08-03 03:26:10 -05:00
parent 751317f21b
commit 03028e52a3
No known key found for this signature in database
GPG key ID: CC9DA35FC5450B76

View file

@ -8,15 +8,6 @@ diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/mai
index 402d8d7d6..ba8d15431 100644
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
@@ -12,7 +12,7 @@ import org.bukkit.util.Vector;
public class PortalTravelAgent {
- private static final BlockPortal a = (BlockPortal) Blocks.NETHER_PORTAL;
+ private static final BlockPortal a = (BlockPortal) Blocks.NETHER_PORTAL; private static final BlockPortal PORTAL_BLOCK = a; // Paper - OBFHELPER
public final WorldServer world; // Paper - private -> public
private final Random c;
private final Long2ObjectMap<PortalTravelAgent.ChunkCoordinatesPortal> d = new Long2ObjectOpenHashMap(4096);
@@ -48,6 +48,9 @@ public class PortalTravelAgent {
byte b0 = 1;
byte b1 = 0;
@ -96,16 +87,16 @@ index 402d8d7d6..ba8d15431 100644
+
+ // Paper start
+ BlockPosition pos = new BlockPosition(blockposition_mutableblockposition.getX(), blockposition_mutableblockposition.getY(), blockposition_mutableblockposition.getZ());
+ nmsBlocks.putIfAbsent(pos, PORTAL_BLOCK.getBlockData());
+ nmsBlocks.putIfAbsent(pos, iblockdata);
+ bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
+ // paper end
+ // Paper end
}
}
+ // Paper start
+ org.bukkit.event.world.PortalCreateEvent event = new org.bukkit.event.world.PortalCreateEvent(bukkitBlocks, this.world.getWorld(), org.bukkit.event.world.PortalCreateEvent.CreateReason.OBC_DESTINATION);
+ if (event.callEvent()) {
+ nmsBlocks.forEach((pos, data) -> this.world.setTypeAndData(pos, data, 2));
+ nmsBlocks.forEach((pos, data) -> this.world.setTypeAndData(pos, data, 18)); // keep flag in sync with removed call above
+ }
+ // Paper end
+