Paper/patches/server-remapped/0729-call-PortalCreateEvent-players-and-end-platform.patch
Mariell Hoversholm a207d14a0e
Rename all patches to correct numbering scheme
Signed-off-by: Mariell Hoversholm <proximyst@proximyst.com>
2021-06-11 15:46:44 +02:00

46 Zeilen
2.7 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Wed, 12 May 2021 03:21:22 -0700
Subject: [PATCH] call PortalCreateEvent players and end platform
diff --git a/src/main/java/net/minecraft/core/BlockPos.java b/src/main/java/net/minecraft/core/BlockPos.java
index 727af6ac84075db87615ebac51a024e6376fa3cb..6e2a272075ead399004dabfb7d4f0ea5fd32ffc2 100644
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
@@ -496,6 +496,7 @@ public class BlockPos extends Vec3i {
return this.set(this.getX() + direction.getStepX() * distance, this.getY() + direction.getStepY() * distance, this.getZ() + direction.getStepZ() * distance);
}
+ public BlockPos.MutableBlockPos withOffset(int x, int y, int z) { return move(x, y, z); } // Paper - OBFHELPER
public BlockPos.MutableBlockPos move(int dx, int dy, int dz) {
return this.set(this.getX() + dx, this.getY() + dy, this.getZ() + dz);
}
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 314f168c9d17ab3654c9dda07e48839570f0d332..5d710a1f4e0c61d4be6efe8cebd9b80789868338 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -1142,15 +1142,21 @@ public class ServerPlayer extends Player implements ContainerListener {
private void createEndPlatform(ServerLevel world, BlockPos centerPos) {
BlockPos.MutableBlockPos blockposition_mutableblockposition = centerPos.mutable();
+ org.bukkit.craftbukkit.util.BlockStateListPopulator blockList = new org.bukkit.craftbukkit.util.BlockStateListPopulator(world); // Paper
for (int i = -2; i <= 2; ++i) {
for (int j = -2; j <= 2; ++j) {
for (int k = -1; k < 3; ++k) {
BlockState iblockdata = k == -1 ? Blocks.OBSIDIAN.defaultBlockState() : Blocks.AIR.defaultBlockState();
- world.setBlockAndUpdate(blockposition_mutableblockposition.set(centerPos).move(j, k, i), iblockdata);
+ blockList.setBlock(blockposition_mutableblockposition.setValues(centerPos).withOffset(j, k, i), iblockdata, 3); // Paper
}
}
}
+ // Paper start
+ if (new org.bukkit.event.world.PortalCreateEvent((List< org.bukkit.block.BlockState>) (List) blockList.getList(), world.getWorld(), this.getBukkitEntity(), org.bukkit.event.world.PortalCreateEvent.CreateReason.END_PLATFORM).callEvent()) {
+ blockList.updateList();
+ }
+ // Paper end
}