mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
Component related conveniences
This commit is contained in:
@@ -0,0 +1,60 @@
|
||||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
||||
From: William Blake Galbreath <blake.galbreath@gmail.com>
|
||||
Date: Sun, 25 Aug 2019 00:09:52 -0500
|
||||
Subject: [PATCH] Dispenser curse of binding protection
|
||||
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/world/entity/Mob.java b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
index e07fbf6ba955a6c80ebf64db4d0f73f24f1aee9a..de3f7b0798d803e6d13a3c95aaaef3045ea22fed 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -62,6 +62,7 @@ import net.minecraft.world.item.ProjectileWeaponItem;
|
||||
import net.minecraft.world.item.SpawnEggItem;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
+import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
@@ -1070,6 +1071,12 @@ public abstract class Mob extends LivingEntity {
|
||||
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public static EquipmentSlot getSlotForDispenser(ItemStack itemstack) {
|
||||
+ return EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BINDING_CURSE, itemstack) > 0 ? EquipmentSlot.MAINHAND : getEquipmentSlotForItem(itemstack);
|
||||
+ }
|
||||
+ // Purpur end
|
||||
+
|
||||
@Nullable
|
||||
public static Item getEquipmentForSlot(EquipmentSlot equipmentSlot, int equipmentLevel) {
|
||||
switch (equipmentSlot) {
|
||||
diff --git a/src/main/java/net/minecraft/world/item/ArmorItem.java b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
index aab4a63e61aced51b1b6c885fd8b8426a4f14408..ad095c6bc7e00d286c83e37f84d8ed5d4a2c6881 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
@@ -56,7 +56,7 @@ public class ArmorItem extends Item implements Wearable {
|
||||
return false;
|
||||
} else {
|
||||
LivingEntity entityliving = (LivingEntity) list.get(0);
|
||||
- EquipmentSlot enumitemslot = Mob.getEquipmentSlotForItem(armor);
|
||||
+ EquipmentSlot enumitemslot = pointer.getLevel().purpurConfig.dispenserApplyCursedArmor ? Mob.getEquipmentSlotForItem(armor) : Mob.getSlotForDispenser(armor); // Purpur
|
||||
ItemStack itemstack1 = armor.split(1);
|
||||
// CraftBukkit start
|
||||
Level world = pointer.getLevel();
|
||||
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
index 6c3fd4120ec84ed00019f765b1ad12b6704292f9..9a3fbdfe9f1c963e5df95aded7082ad7f57bb966 100644
|
||||
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
|
||||
@@ -205,6 +205,11 @@ public class PurpurWorldConfig {
|
||||
voidDamageDealt = getDouble("gameplay-mechanics.void-damage-dealt", voidDamageDealt);
|
||||
}
|
||||
|
||||
+ public boolean dispenserApplyCursedArmor = true;
|
||||
+ private void dispenserSettings() {
|
||||
+ dispenserApplyCursedArmor = getBoolean("blocks.dispenser.apply-cursed-to-armor-slots", dispenserApplyCursedArmor);
|
||||
+ }
|
||||
+
|
||||
public boolean farmlandGetsMoistFromBelow = false;
|
||||
private void farmlandSettings() {
|
||||
farmlandGetsMoistFromBelow = getBoolean("blocks.farmland.gets-moist-from-below", farmlandGetsMoistFromBelow);
|
||||
Reference in New Issue
Block a user