Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-17 20:10:10 +01:00
05466e3b47
Upstream has released updates that appear to apply compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing. Bukkit Changes: d2834556 SPIGOT-4219: Event for PigZombies angering. CraftBukkit Changes:a9c796f1
SPIGOT-4184: Fix furnaces not matching Vanilla smelt or animations195f071e
SPIGOT-4219: Event for PigZombies angering.5e3082c7
SPIGOT-4230: Improve legacy block types
109 Zeilen
5.4 KiB
Diff
109 Zeilen
5.4 KiB
Diff
From 53121b6463406e4fa83e4f49da16b28cf25f400a Mon Sep 17 00:00:00 2001
|
|
From: MiniDigger <admin@minidigger.me>
|
|
Date: Sun, 18 Mar 2018 15:44:44 +0100
|
|
Subject: [PATCH] Call PortalCreateEvent for exit portals
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/PortalTravelAgent.java b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
index 402d8d7d63..7444f4621e 100644
|
|
--- a/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
+++ b/src/main/java/net/minecraft/server/PortalTravelAgent.java
|
|
@@ -48,6 +48,9 @@ public class PortalTravelAgent {
|
|
byte b0 = 1;
|
|
byte b1 = 0;
|
|
|
|
+ java.util.Collection<org.bukkit.block.Block> bukkitBlocks = new java.util.HashSet<>(); // Paper
|
|
+ java.util.Map<BlockPosition, IBlockData> nmsBlocks = new java.util.LinkedHashMap<>(); // Paper
|
|
+
|
|
for (int l = -2; l <= 2; ++l) {
|
|
for (int i1 = -2; i1 <= 2; ++i1) {
|
|
for (int j1 = -1; j1 < 3; ++j1) {
|
|
@@ -56,11 +59,22 @@ public class PortalTravelAgent {
|
|
int i2 = k + i1 * 0 - l * 1;
|
|
boolean flag2 = j1 < 0;
|
|
|
|
- this.world.setTypeUpdate(new BlockPosition(k1, l1, i2), flag2 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
|
|
+ // Paper start
|
|
+ BlockPosition pos = new BlockPosition(k1, l1, i2);
|
|
+ nmsBlocks.putIfAbsent(pos, flag2 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
|
|
+ bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
|
+ // 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(this.world::setTypeUpdate);
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
// CraftBukkit start
|
|
return new BlockPosition(i, k, k);
|
|
}
|
|
@@ -404,6 +418,9 @@ public class PortalTravelAgent {
|
|
l5 = -l5;
|
|
}
|
|
|
|
+ java.util.Collection<org.bukkit.block.Block> bukkitBlocks = new java.util.HashSet<>(); // Paper
|
|
+ java.util.Map<BlockPosition, IBlockData> nmsBlocks = new java.util.LinkedHashMap<>(); // Paper
|
|
+
|
|
if (d0 < 0.0D) {
|
|
i1 = MathHelper.clamp(i1, 70, this.world.aa() - 10);
|
|
j5 = i1;
|
|
@@ -416,8 +433,11 @@ public class PortalTravelAgent {
|
|
l3 = j2 + (l2 - 1) * l5 - k2 * k5;
|
|
boolean flag1 = i3 < 0;
|
|
|
|
- blockposition_mutableblockposition.c(j3, k3, l3);
|
|
- this.world.setTypeUpdate(blockposition_mutableblockposition, flag1 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
|
|
+ // Paper start
|
|
+ BlockPosition pos = new BlockPosition(j3, k3, l3);
|
|
+ nmsBlocks.putIfAbsent(pos, flag1 ? Blocks.OBSIDIAN.getBlockData() : Blocks.AIR.getBlockData());
|
|
+ bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
|
+ // Paper end
|
|
}
|
|
}
|
|
}
|
|
@@ -427,7 +447,11 @@ public class PortalTravelAgent {
|
|
for (l2 = -1; l2 < 4; ++l2) {
|
|
if (k2 == -1 || k2 == 2 || l2 == -1 || l2 == 3) {
|
|
blockposition_mutableblockposition.c(i5 + k2 * k5, j5 + l2, j2 + k2 * l5);
|
|
- this.world.setTypeAndData(blockposition_mutableblockposition, Blocks.OBSIDIAN.getBlockData(), 3);
|
|
+ // Paper start
|
|
+ BlockPosition pos = new BlockPosition(blockposition_mutableblockposition.getX(), blockposition_mutableblockposition.getY(), blockposition_mutableblockposition.getZ());
|
|
+ nmsBlocks.putIfAbsent(pos, Blocks.OBSIDIAN.getBlockData());
|
|
+ bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
|
+ // Paper end
|
|
}
|
|
}
|
|
}
|
|
@@ -437,10 +461,22 @@ public class PortalTravelAgent {
|
|
for (l2 = 0; l2 < 2; ++l2) {
|
|
for (i3 = 0; i3 < 3; ++i3) {
|
|
blockposition_mutableblockposition.c(i5 + l2 * k5, j5 + i3, j2 + l2 * l5);
|
|
- this.world.setTypeAndData(blockposition_mutableblockposition, iblockdata, 18);
|
|
+
|
|
+ // Paper start
|
|
+ BlockPosition pos = new BlockPosition(blockposition_mutableblockposition.getX(), blockposition_mutableblockposition.getY(), blockposition_mutableblockposition.getZ());
|
|
+ nmsBlocks.putIfAbsent(pos, iblockdata);
|
|
+ bukkitBlocks.add(this.world.getWorld().getBlockAt(pos.getX(), pos.getY(), pos.getZ()));
|
|
+ // 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, 18)); // keep flag in sync with removed call above
|
|
+ }
|
|
+ // Paper end
|
|
+
|
|
return true;
|
|
}
|
|
|
|
--
|
|
2.18.0
|
|
|