From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Encode42 <me@encode42.dev>
Date: Mon, 25 Jan 2021 11:36:39 -0500
Subject: [PATCH] Config to use infinity bows without arrows

Allows for bows with infinity to be used without any arrows in the player's inventory.
Uses a standard arrow when shot.

diff --git a/src/main/java/net/minecraft/world/item/ItemBow.java b/src/main/java/net/minecraft/world/item/ItemBow.java
index c7e20b25b4d09463fa54c66e62208e90515013e2..59b803ec4552058f2dda269e9435daf65be10559 100644
--- a/src/main/java/net/minecraft/world/item/ItemBow.java
+++ b/src/main/java/net/minecraft/world/item/ItemBow.java
@@ -130,7 +130,7 @@ public class ItemBow extends ItemProjectileWeapon implements ItemVanishable {
         ItemStack itemstack = entityhuman.b(enumhand);
         boolean flag = !entityhuman.f(itemstack).isEmpty();
 
-        if (!entityhuman.abilities.canInstantlyBuild && !flag) {
+        if (!(world.purpurConfig.infinityWorksWithoutArrows && EnchantmentManager.getEnchantmentLevel(Enchantments.ARROW_INFINITE, itemstack) > 0) && !entityhuman.abilities.canInstantlyBuild && !flag) { // Purpur
             return InteractionResultWrapper.fail(itemstack);
         } else {
             entityhuman.c(enumhand);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 8e4843e47abf4a084653b0e338eb72f1e5c1e1b3..b701402cf9109aa9729bd3ab5585d24532147246 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -209,10 +209,12 @@ public class PurpurWorldConfig {
         idleTimeoutUpdateTabList = getBoolean("gameplay-mechanics.player.idle-timeout.update-tab-list", idleTimeoutUpdateTabList);
     }
 
+    public boolean infinityWorksWithoutArrows = false;
     public boolean infinityWorksWithNormalArrows = true;
     public boolean infinityWorksWithSpectralArrows = false;
     public boolean infinityWorksWithTippedArrows = false;
     private void infinityArrowsSettings() {
+        infinityWorksWithoutArrows = getBoolean("gameplay-mechanics.infinity-bow.works-without-arrows", infinityWorksWithoutArrows);
         infinityWorksWithNormalArrows = getBoolean("gameplay-mechanics.infinity-bow.normal-arrows", infinityWorksWithNormalArrows);
         infinityWorksWithSpectralArrows = getBoolean("gameplay-mechanics.infinity-bow.spectral-arrows", infinityWorksWithSpectralArrows);
         infinityWorksWithTippedArrows = getBoolean("gameplay-mechanics.infinity-bow.tipped-arrows", infinityWorksWithTippedArrows);
