Paper/patches/server/0678-call-PortalCreateEvent-players-and-end-platform.patch

46 Zeilen
2.7 KiB
Diff

2021-06-11 14:02:28 +02:00
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 b98316165c6d10945ccc9e5e0c3f0be9cfc3e889..84eca485a09c6d147f3baa277e398de58a9dc147 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/core/BlockPos.java
+++ b/src/main/java/net/minecraft/core/BlockPos.java
2021-06-15 15:55:25 +02:00
@@ -523,6 +523,7 @@ public class BlockPos extends Vec3i {
2021-06-11 14:02:28 +02:00
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
2021-06-17 10:37:27 +02:00
index 63a89a95cb40d2e39104c2c3f3991dd40cf1ca01..d61f7dc29968b6297c7f3884c0fcb255073ddb99 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2021-06-17 10:37:27 +02:00
@@ -1168,15 +1168,21 @@ public class ServerPlayer extends Player {
2021-06-11 14:02:28 +02:00
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);
2021-06-15 04:59:31 +02:00
+ blockList.setBlock(blockposition_mutableblockposition.set(centerPos).move(j, k, i), iblockdata, 3); // Paper
2021-06-11 14:02:28 +02:00
}
}
}
+ // 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
}