mirror of
https://github.com/PurpurMC/Purpur.git
synced 2026-02-22 10:57:43 +01:00
progress on silk touch spawner patch
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 3d5f08d673f6b95c8f87070345f1fb200b5f4bde..c4392a997061aa4939e5ad7dcacf5e39cbecc55a 100644
|
||||
--- a/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
+++ b/src/main/java/net/minecraft/world/entity/Mob.java
|
||||
@@ -75,6 +75,7 @@ import net.minecraft.world.item.SpawnEggItem;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.component.ItemAttributeModifiers;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
+import net.minecraft.world.item.enchantment.Enchantments;
|
||||
import net.minecraft.world.level.GameRules;
|
||||
import net.minecraft.world.level.ItemLike;
|
||||
import net.minecraft.world.level.Level;
|
||||
@@ -1309,6 +1310,12 @@ public abstract class Mob extends LivingEntity implements EquipmentUser, Targeti
|
||||
|
||||
}
|
||||
|
||||
+ // Purpur start
|
||||
+ public static @Nullable EquipmentSlot getSlotForDispenser(ItemStack itemstack) {
|
||||
+ return EnchantmentHelper.getItemEnchantmentLevel(Enchantments.BINDING_CURSE, itemstack) > 0 ? null : 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 786e4a8700cb84b16dd9b8892a0d1d5803924d81..b108ca4c7900ccf6a14ebea01c21c103459054f8 100644
|
||||
--- a/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
+++ b/src/main/java/net/minecraft/world/item/ArmorItem.java
|
||||
@@ -69,7 +69,7 @@ public class ArmorItem extends Item implements Equipable {
|
||||
return false;
|
||||
} else {
|
||||
LivingEntity entityliving = (LivingEntity) list.get(0);
|
||||
- EquipmentSlot enumitemslot = Mob.getEquipmentSlotForItem(armor);
|
||||
+ EquipmentSlot enumitemslot = pointer.level().purpurConfig.dispenserApplyCursedArmor ? Mob.getEquipmentSlotForItem(armor) : Mob.getSlotForDispenser(armor); if (enumitemslot == null) return false; // Purpur
|
||||
ItemStack itemstack1 = armor.copyWithCount(1); // Paper - shrink below and single item in event
|
||||
// CraftBukkit start
|
||||
Level world = pointer.level();
|
||||
diff --git a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
index 03c35e455b405517114ffc043732359c112e343f..27c1f09be7d664073263a02a8854ff1e8c6f9ab1 100644
|
||||
--- a/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
+++ b/src/main/java/org/purpurmc/purpur/PurpurWorldConfig.java
|
||||
@@ -224,6 +224,11 @@ public class PurpurWorldConfig {
|
||||
});
|
||||
}
|
||||
|
||||
+ 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