Skip to content

Commit

Permalink
Bow infinity fix
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Jul 24, 2023
1 parent 413f258 commit feb7fb4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 2 deletions.
9 changes: 7 additions & 2 deletions patches/server/0004-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ index 35d2da9d91dcdd89de7c0f4af028fd182376ea8d..d73482fb1e71fe2951e96ae0593de268
.withRequiredArg()
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..dd6c1d304914b9387da4b741707878ee1fe38935
index 0000000000000000000000000000000000000000..f0424eba1d6e01c13497a15c858c4e90ae1a85a5
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,946 @@
@@ -0,0 +1,951 @@
+package top.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
Expand Down Expand Up @@ -903,6 +903,11 @@ index 0000000000000000000000000000000000000000..dd6c1d304914b9387da4b741707878ee
+ avoidAnvilTooExpensive = getBoolean("settings.modify.avoid-anvil-too-expensive", avoidAnvilTooExpensive);
+ }
+
+ public static boolean bowInfinityFix = false;
+ private static void bowInfinityFix() {
+ bowInfinityFix = getBoolean("settings.modify.bow-infinity-fix", bowInfinityFix);
+ }
+
+ public static final class WorldConfig {
+
+ public final String worldName;
Expand Down
19 changes: 19 additions & 0 deletions patches/server/0113-Bow-infinity-fix.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: violetc <58360096+s-yh-china@users.noreply.github.com>
Date: Mon, 24 Jul 2023 15:54:18 +0800
Subject: [PATCH] Bow infinity fix


diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java
index 08d597db1a5345a343777a01427655e6bf2c926b..d4127e4b437960670d5c91179a726b433659b317 100644
--- a/src/main/java/net/minecraft/world/item/BowItem.java
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
@@ -130,7 +130,7 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable {
@Override
public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) {
ItemStack itemstack = user.getItemInHand(hand);
- boolean flag = !user.getProjectile(itemstack).isEmpty();
+ boolean flag = !user.getProjectile(itemstack).isEmpty() || (top.leavesmc.leaves.LeavesConfig.bowInfinityFix && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.INFINITY_ARROWS, itemstack) > 0);

if (!user.getAbilities().instabuild && !flag) {
return InteractionResultHolder.fail(itemstack);

0 comments on commit feb7fb4

Please sign in to comment.