From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Sun, 4 Oct 2020 19:08:53 -0500
Subject: [PATCH] Infinity bow settings


diff --git a/src/main/java/net/minecraft/world/item/BowItem.java b/src/main/java/net/minecraft/world/item/BowItem.java
index afe33f20578177cb517e1c116e6319481642e66c..fe4695adbb506733b4029ecfabcfda3d23dde52a 100644
--- a/src/main/java/net/minecraft/world/item/BowItem.java
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
@@ -38,7 +38,7 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable {
                 float f = BowItem.getPowerForTime(j);
 
                 if ((double) f >= 0.1D) {
-                    boolean flag1 = flag && itemstack1.is(Items.ARROW);
+                    boolean flag1 = flag && ((itemstack1.is(Items.ARROW) && world.purpurConfig.infinityWorksWithNormalArrows) || (itemstack1.is(Items.TIPPED_ARROW) && world.purpurConfig.infinityWorksWithTippedArrows) || (itemstack1.is(Items.SPECTRAL_ARROW) && world.purpurConfig.infinityWorksWithSpectralArrows)); // Purpur                    if (!world.isClientSide) {
 
                     if (!world.isClientSide) {
                         ArrowItem itemarrow = (ArrowItem) (itemstack1.getItem() instanceof ArrowItem ? itemstack1.getItem() : Items.ARROW);
@@ -132,7 +132,7 @@ public class BowItem extends ProjectileWeaponItem implements Vanishable {
         ItemStack itemstack = user.getItemInHand(hand);
         boolean flag = !user.getProjectile(itemstack).isEmpty();
 
-        if (!user.getAbilities().instabuild && !flag) {
+        if (!(world.purpurConfig.infinityWorksWithoutArrows && EnchantmentHelper.getItemEnchantmentLevel(Enchantments.INFINITY_ARROWS, itemstack) > 0) && !user.getAbilities().instabuild && !flag) { // Purpur
             return InteractionResultHolder.fail(itemstack);
         } else {
             user.startUsingItem(hand);
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 33e2317646ca7b77537c8d52235f5a194717c439..9a4e52097e767ac00a5a9dde3137efc28858300e 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -122,6 +122,17 @@ public class PurpurWorldConfig {
         entityLifeSpan = getInt("gameplay-mechanics.entity-lifespan", entityLifeSpan);
     }
 
+    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);
+    }
+
     public List<Item> itemImmuneToCactus = new ArrayList<>();
     public List<Item> itemImmuneToExplosion = new ArrayList<>();
     public List<Item> itemImmuneToFire = new ArrayList<>();
