Paper/patches/server/0897-Add-Sneaking-API-for-Entities.patch
Jake Potrebic 0cdce89d59
Fix a bunch of stuff with player spawn locations (#9887)
If a playerdata doesn't contain a valid, loaded world, reset
to the main world spawn point
2023-11-04 14:11:55 -07:00

30 lines
1.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: dawon <dawon@dawon.eu>
Date: Wed, 19 Oct 2022 23:31:53 +0200
Subject: [PATCH] Add Sneaking API for Entities
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index dc1cc4db2195d4f346bdc5f39e2e14dba454f13d..841a007f24c3d9be2e8b6a9d03ba1694544996fd 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1218,6 +1218,18 @@ public abstract class CraftEntity implements org.bukkit.entity.Entity {
return Pose.values()[this.getHandle().getPose().ordinal()];
}
+ // Paper start
+ @Override
+ public void setSneaking(boolean sneak) {
+ this.getHandle().setShiftKeyDown(sneak);
+ }
+
+ @Override
+ public boolean isSneaking() {
+ return this.getHandle().isShiftKeyDown();
+ }
+ // Paper end
+
@Override
public SpawnCategory getSpawnCategory() {
return CraftSpawnCategory.toBukkit(this.getHandle().getType().getCategory());