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

Paper Changes:
PaperMC/Paper@3c8a7fe Re-add missing chunk event calls (#11104)
PaperMC/Paper@a8db527 Even more cleanup of mcutil patch
PaperMC/Paper@d08e8d1 Add total time to done message (#11109)
2024-07-18 22:03:38 -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 a0e89374b94852352400d5089052433b6de0fd92..85e16939a1ac27037b1959e4fc1ec57324a7c11e 100644
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
@@ -137,6 +137,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<>();