Files
Purpur/patches/server/0094-Infinity-bow-settings.patch
granny 639bcbd780 Updated Upstream (Paper)
Upstream has released updates that appear to apply and compile correctly

Paper Changes:
PaperMC/Paper@f9c7f2a Begin switching to JSpecify annotations (#11448)
PaperMC/Paper@e3c8a8e Add PlayerInsertLecternBookEvent [1.20 port] (#7305)
PaperMC/Paper@b410fe8 Configurable per-world void damage offset/damage(#11436)
PaperMC/Paper@ea00be3 Do not NPE on uuid resolution in player profile (#11449)
PaperMC/Paper@ba3c29b Finish converting all events to jspecify annotations
PaperMC/Paper@e7e1ab5 Finish converting most of the undeprecated api to jspecify
PaperMC/Paper@69ffbec Fix hex color check
PaperMC/Paper@709f0f2 Use components properly in ProfileWhitelistVerifyEvent (#11456)
PaperMC/Paper@fb76840 [ci skip] Add section on nullability annotations (#11461)
PaperMC/Paper@7cd4f2c Check if leash tag has a uuid
2024-10-03 17:08:59 -07:00

48 lines
3.0 KiB
Diff

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 6eb5c0f23d9dc61e69ad5ad493c89602a9dcd4b5..4db2032178471860baddc6b669c9a4f8cffd084b 100644
--- a/src/main/java/net/minecraft/world/item/BowItem.java
+++ b/src/main/java/net/minecraft/world/item/BowItem.java
@@ -26,6 +26,11 @@ public class BowItem extends ProjectileWeaponItem {
public void releaseUsing(ItemStack stack, Level world, LivingEntity user, int remainingUseTicks) {
if (user instanceof Player player) {
ItemStack itemStack = player.getProjectile(stack);
+ // Purpur start
+ if (world.purpurConfig.infinityWorksWithoutArrows && itemStack.isEmpty() && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, stack) > 0) {
+ itemStack = new ItemStack(Items.ARROW);
+ }
+ // Purpur end
if (!itemStack.isEmpty()) {
int i = this.getUseDuration(stack, user) - remainingUseTicks;
float f = getPowerForTime(i);
@@ -82,7 +87,7 @@ public class BowItem extends ProjectileWeaponItem {
public InteractionResultHolder<ItemStack> use(Level world, Player user, InteractionHand hand) {
ItemStack itemStack = user.getItemInHand(hand);
boolean bl = !user.getProjectile(itemStack).isEmpty();
- if (!user.hasInfiniteMaterials() && !bl) {
+ if (!user.hasInfiniteMaterials() && !bl && !(world.purpurConfig.infinityWorksWithoutArrows && net.minecraft.world.item.enchantment.EnchantmentHelper.getItemEnchantmentLevel(net.minecraft.world.item.enchantment.Enchantments.INFINITY, itemStack) > 0)) { // Purpur
return InteractionResultHolder.fail(itemStack);
} else {
user.startUsingItem(hand);
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
index 0c852bdc84dbb3fc9855dc69269daac2e2dfe305..c28c1a42600345468edd87ff2bf6223d8b0398bf 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -135,6 +135,11 @@ public class PurpurWorldConfig {
entityLifeSpan = getInt("gameplay-mechanics.entity-lifespan", entityLifeSpan);
}
+ public boolean infinityWorksWithoutArrows = false;
+ private void infinityArrowsSettings() {
+ infinityWorksWithoutArrows = getBoolean("gameplay-mechanics.infinity-bow.works-without-arrows", infinityWorksWithoutArrows);
+ }
+
public List<Item> itemImmuneToCactus = new ArrayList<>();
public List<Item> itemImmuneToExplosion = new ArrayList<>();
public List<Item> itemImmuneToFire = new ArrayList<>();