diff options
author | Noah van der Aa <[email protected]> | 2024-10-24 00:11:28 +0200 |
---|---|---|
committer | Noah van der Aa <[email protected]> | 2024-10-24 00:11:28 +0200 |
commit | dd87f9fe83f98116d2b79102edcd74ab72efd2f4 (patch) | |
tree | 3f8f72938366f9e36eaa407612ca99be2591e412 | |
parent | 4baf9ab44d4377dc9bcb9c1ce4b8a08f2a4b2dd3 (diff) | |
download | Paper-dd87f9fe83f98116d2b79102edcd74ab72efd2f4.tar.gz Paper-dd87f9fe83f98116d2b79102edcd74ab72efd2f4.zip |
fix gruesome copyright violation
-rw-r--r-- | patches/server/0776-Improve-PortalEvents.patch | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/patches/server/0776-Improve-PortalEvents.patch b/patches/server/0776-Improve-PortalEvents.patch index f90d31290b..56e73369b7 100644 --- a/patches/server/0776-Improve-PortalEvents.patch +++ b/patches/server/0776-Improve-PortalEvents.patch @@ -101,84 +101,3 @@ index fb361eac03c16ecee02219ff0524cce2292c7976..2b31bf586c1c0bd393d2aa8d0b6635dd } else { boolean flag = worldserver1.getTypeKey() == LevelStem.NETHER; // CraftBukkit end -diff --git a/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java b/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java -new file mode 100644 -index 0000000000000000000000000000000000000000..36c8735312c885eb153f4ffdf0f2a5495e9c9f65 ---- /dev/null -+++ b/src/main/java/net/minecraft/world/level/portal/DimensionTransition.java -@@ -0,0 +1,75 @@ -+package net.minecraft.world.level.portal; -+ -+import net.minecraft.core.BlockPos; -+import net.minecraft.network.protocol.game.ClientboundLevelEventPacket; -+import net.minecraft.server.level.ServerLevel; -+import net.minecraft.server.level.ServerPlayer; -+import net.minecraft.world.entity.Entity; -+import net.minecraft.world.phys.Vec3; -+// CraftBukkit start -+import org.bukkit.event.player.PlayerTeleportEvent; -+ -+public record DimensionTransition(ServerLevel newLevel, Vec3 pos, Vec3 speed, float yRot, float xRot, boolean missingRespawnBlock, DimensionTransition.PostDimensionTransition postDimensionTransition, PlayerTeleportEvent.TeleportCause cause) { -+ -+ public DimensionTransition(ServerLevel newLevel, Vec3 pos, Vec3 speed, float yRot, float xRot, boolean missingRespawnBlock, DimensionTransition.PostDimensionTransition postDimensionTransition) { -+ this(newLevel, pos, speed, yRot, xRot, missingRespawnBlock, postDimensionTransition, PlayerTeleportEvent.TeleportCause.UNKNOWN); -+ } -+ -+ // Paper - remove unused constructor (for safety) -+ // CraftBukkit end -+ -+ public static final DimensionTransition.PostDimensionTransition DO_NOTHING = (entity) -> { -+ }; -+ public static final DimensionTransition.PostDimensionTransition PLAY_PORTAL_SOUND = DimensionTransition::playPortalSound; -+ public static final DimensionTransition.PostDimensionTransition PLACE_PORTAL_TICKET = DimensionTransition::placePortalTicket; -+ -+ public DimensionTransition(ServerLevel world, Vec3 pos, Vec3 velocity, float yaw, float pitch, DimensionTransition.PostDimensionTransition postDimensionTransition) { -+ // CraftBukkit start -+ this(world, pos, velocity, yaw, pitch, postDimensionTransition, PlayerTeleportEvent.TeleportCause.UNKNOWN); -+ } -+ -+ public DimensionTransition(ServerLevel worldserver, Vec3 vec3d, Vec3 vec3d1, float f, float f1, DimensionTransition.PostDimensionTransition dimensiontransition_a, PlayerTeleportEvent.TeleportCause cause) { -+ this(worldserver, vec3d, vec3d1, f, f1, false, dimensiontransition_a, cause); -+ } -+ -+ public DimensionTransition(ServerLevel world, Entity entity, DimensionTransition.PostDimensionTransition postDimensionTransition) { -+ this(world, entity, postDimensionTransition, PlayerTeleportEvent.TeleportCause.UNKNOWN); -+ } -+ -+ public DimensionTransition(ServerLevel worldserver, Entity entity, DimensionTransition.PostDimensionTransition dimensiontransition_a, PlayerTeleportEvent.TeleportCause cause) { -+ this(worldserver, findAdjustedSharedSpawnPos(worldserver, entity), Vec3.ZERO, worldserver.getSharedSpawnAngle(), 0.0F, false, dimensiontransition_a, cause); // Paper - MC-200092 - fix spawn pos yaw being ignored -+ // CraftBukkit end -+ } -+ -+ private static void playPortalSound(Entity entity) { -+ if (entity instanceof ServerPlayer entityplayer) { -+ entityplayer.connection.send(new ClientboundLevelEventPacket(1032, BlockPos.ZERO, 0, false)); -+ } -+ -+ } -+ -+ private static void placePortalTicket(Entity entity) { -+ entity.placePortalTicket(BlockPos.containing(entity.position())); -+ } -+ -+ public static DimensionTransition missingRespawnBlock(ServerLevel world, Entity entity, DimensionTransition.PostDimensionTransition postDimensionTransition) { -+ return new DimensionTransition(world, findAdjustedSharedSpawnPos(world, entity), Vec3.ZERO, world.getSharedSpawnAngle(), 0.0F, true, postDimensionTransition); // Paper - MC-200092 - fix spawn pos yaw being ignored -+ } -+ -+ private static Vec3 findAdjustedSharedSpawnPos(ServerLevel world, Entity entity) { -+ return entity.adjustSpawnLocation(world, world.getSharedSpawnPos()).getBottomCenter(); -+ } -+ -+ @FunctionalInterface -+ public interface PostDimensionTransition { -+ -+ void onTransition(Entity entity); -+ -+ default DimensionTransition.PostDimensionTransition then(DimensionTransition.PostDimensionTransition next) { -+ return (entity) -> { -+ this.onTransition(entity); -+ next.onTransition(entity); -+ }; -+ } -+ } -+} |