mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-17 16:37:43 +01:00
Infinity bow settings
This commit is contained in:
committed by
granny
parent
6f8ae53ef5
commit
13ce5ce283
@@ -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);
|
||||
@@ -126,6 +126,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<>();
|
||||
|
||||
Reference in New Issue
Block a user