9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-04 15:41:31 +00:00

Fix fakeplayer action

This commit is contained in:
violetc
2022-12-16 08:14:08 +08:00
parent c1b30dade4
commit 46a2465e57

View File

@@ -143,7 +143,7 @@ index 2e6557a19523d18aecff709de30cb4466b46a9fa..b884439a537a938f0636ccdcd1447891
if (itemstack.getItem() instanceof SwordItem) {
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
index 6cd6cb256bde958416a0e4b13fc1d3df74f230fd..e1f14b77a900fa269e72c53c12ca4a5929a5ddc5 100644
index 78f53ee557276de85f0431ebcb146445b1f4fb92..42a2e411fd769bf0bf034141297e890c20d39b51 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftEntity.java
@@ -190,6 +190,8 @@ import org.bukkit.plugin.Plugin;
@@ -1698,7 +1698,7 @@ index 0000000000000000000000000000000000000000..768d505ccfaf94befd39d607fec69145
+}
diff --git a/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemOnAction.java b/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemOnAction.java
new file mode 100644
index 0000000000000000000000000000000000000000..58d6bcd4c6b6b02c42b7175e192b76002135d3c9
index 0000000000000000000000000000000000000000..eaf38ebbd40677311323c646d34cb5cb9a366845
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/bot/agent/action/UseItemOnAction.java
@@ -0,0 +1,32 @@
@@ -1706,7 +1706,7 @@ index 0000000000000000000000000000000000000000..58d6bcd4c6b6b02c42b7175e192b7600
+
+import net.minecraft.server.level.ServerPlayer;
+import net.minecraft.world.InteractionHand;
+import net.minecraft.world.InteractionResult;
+import net.minecraft.world.level.ClipContext;
+import net.minecraft.world.phys.BlockHitResult;
+import net.minecraft.world.phys.HitResult;
+import org.jetbrains.annotations.NotNull;
@@ -1725,7 +1725,7 @@ index 0000000000000000000000000000000000000000..58d6bcd4c6b6b02c42b7175e192b7600
+
+ @Override
+ public boolean doTick(@NotNull ServerBot bot) {
+ HitResult result = bot.getRayTrace(4);
+ HitResult result = bot.getRayTrace(4, ClipContext.Fluid.NONE);
+ if (result.getType() == HitResult.Type.BLOCK) {
+ bot.punch();
+ bot.updateItemInMainHand();