Infinity bow settings

This commit is contained in:
William Blake Galbreath
2025-01-09 19:31:29 -08:00
committed by granny
parent 6f8ae53ef5
commit 13ce5ce283
3 changed files with 28 additions and 47 deletions

View File

@@ -0,0 +1,23 @@
--- a/net/minecraft/world/item/BowItem.java
+++ b/net/minecraft/world/item/BowItem.java
@@ -28,6 +_,11 @@
return false;
} else {
ItemStack projectile = player.getProjectile(stack);
+ // Purpur start - Infinity bow settings
+ if (level.purpurConfig.infinityWorksWithoutArrows && projectile.isEmpty() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, stack) > 0) {
+ projectile = new ItemStack(Items.ARROW);
+ }
+ // Purpur end - Infinity bow settings
if (projectile.isEmpty()) {
return false;
} else {
@@ -89,7 +_,7 @@
public InteractionResult use(Level level, Player player, InteractionHand hand) {
ItemStack itemInHand = player.getItemInHand(hand);
boolean flag = !player.getProjectile(itemInHand).isEmpty();
- if (!player.hasInfiniteMaterials() && !flag) {
+ if (!player.hasInfiniteMaterials() && !flag && !(level.purpurConfig.infinityWorksWithoutArrows && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, itemInHand) > 0)) { // Purpur - Infinity bow settings
return InteractionResult.FAIL;
} else {
player.startUsingItem(hand);