From 03028e52a34883115367f3e73edf7a2709735aca Mon Sep 17 00:00:00 2001 From: Zach Brown Date: Fri, 3 Aug 2018 03:26:10 -0500 Subject: [PATCH] Use correct update flag and blockdata for portals Fixes GH-1286 --- ...l-PortalCreateEvent-for-exit-portals.patch | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/Spigot-Server-Patches/0246-Call-PortalCreateEvent-for-exit-portals.patch b/Spigot-Server-Patches/0246-Call-PortalCreateEvent-for-exit-portals.patch index 34274d578f..23620384eb 100644 --- a/Spigot-Server-Patches/0246-Call-PortalCreateEvent-for-exit-portals.patch +++ b/Spigot-Server-Patches/0246-Call-PortalCreateEvent-for-exit-portals.patch @@ -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 d = new Long2ObjectOpenHashMap(4096); @@ -48,6 +48,9 @@ public class PortalTravelAgent { byte b0 = 1; byte b1 = 0; @@ -43,7 +34,7 @@ index 402d8d7d6..ba8d15431 100644 + // 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()){ ++ if (event.callEvent()) { + nmsBlocks.forEach(this.world::setTypeUpdate); + } + // Paper end @@ -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)); ++ if (event.callEvent()) { ++ nmsBlocks.forEach((pos, data) -> this.world.setTypeAndData(pos, data, 18)); // keep flag in sync with removed call above + } + // Paper end +