Add PlayerLandEvent

This commit is contained in:
StillLutto 2024-06-09 12:36:41 +02:00
parent 4497cf0633
commit c70e13c418

View File

@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: StillLutto <iameinsteinhe@gmail.com>
Date: Sun, 9 Jun 2024 12:34:52 +0200
Subject: [PATCH] Add PlayerLandEvent
diff --git a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
index 8e6d05933857764ef582a31088f7a97eed8c4cc9..eea852d36ec9ce8703f5c4474646e3fa56fc6f2d 100644
--- a/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
+++ b/src/main/java/net/minecraft/server/network/ServerGamePacketListenerImpl.java
@@ -193,7 +193,6 @@ import net.minecraft.world.phys.Vec3;
import net.minecraft.world.phys.shapes.BooleanOp;
import net.minecraft.world.phys.shapes.Shapes;
import net.minecraft.world.phys.shapes.VoxelShape;
-import org.bukkit.craftbukkit.block.CraftBlock;
import org.slf4j.Logger;
// CraftBukkit start
@@ -1592,19 +1591,18 @@ public class ServerGamePacketListenerImpl extends ServerCommonPacketListenerImpl
this.player.absMoveTo(d0, d1, d2, f, f1);
boolean flag4 = this.player.isAutoSpinAttack();
+ this.clientIsFloating = d11 >= -0.03125D && !flag2 && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !flag && !flag4 && this.noBlocksAround(this.player);
+ this.player.serverLevel().getChunkSource().move(this.player);
+ this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround());
+ this.player.setOnGroundWithKnownMovement(packet.isOnGround(), new Vec3(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5));
// Paper start - Add PlayerLandEvent
- if (flag2 && !(this.player.getY() - d4 >= 0.0)) {
+ if (flag2 && (this.player.getY() - d4 >= 0.0)) {
this.player.setOnGround(true);
- final org.bukkit.block.Block mainSupportingBlock = CraftBlock.at(this.player.level(), this.player.mainSupportingBlockPos.get());
+ final org.bukkit.block.Block mainSupportingBlock = org.bukkit.craftbukkit.block.CraftBlock.at(this.player.level(), this.player.mainSupportingBlockPos.get());
io.papermc.paper.event.player.PlayerLandEvent event = new io.papermc.paper.event.player.PlayerLandEvent(player, from, to, mainSupportingBlock);
event.callEvent();
}
// Paper end - Add PlayerLandEvent
-
- this.clientIsFloating = d11 >= -0.03125D && !flag2 && this.player.gameMode.getGameModeForPlayer() != GameType.SPECTATOR && !this.server.isFlightAllowed() && !this.player.getAbilities().mayfly && !this.player.hasEffect(MobEffects.LEVITATION) && !flag && !flag4 && this.noBlocksAround(this.player);
- this.player.serverLevel().getChunkSource().move(this.player);
- this.player.doCheckFallDamage(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5, packet.isOnGround());
- this.player.setOnGroundWithKnownMovement(packet.isOnGround(), new Vec3(this.player.getX() - d3, this.player.getY() - d4, this.player.getZ() - d5));
if (flag1) {
this.player.resetFallDistance();
}