Paper/patches/server/0914-Add-Sneaking-API-for-Entities.patch
Bjarne Koll 2873869bb1
Drop manual isEditable copy in CraftSign
Signs no longer have a specific isEdiable state, the entire API in this
regard needs updating/deprecation. The boolean field is completely gone,
replaced by a uuid (which will need a new setEditingPlayer(UUID) method
on the Sign interface), and the current upstream implementation of
setEdiable simply flips the is_waxed state.

This patch is hence not needed as it neither allows editing (which will
be redone in a later patch) nor is required to copy the is_waxed boolean
flag as it lives in the signs compound tag and is covered by applyTo.
2023-06-08 11:35:39 +02: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 b8550052bfde2b2b97fa4497e6e5d055e6161529..e7d311e94d637cabfd906f7021c4218f445915fe 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -1198,6 +1198,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());