Re-add missing patch for IForgeItem#getEquipmentSlot (#8041)

This commit is contained in:
sciwhiz12 authored and GitHub committed 2021-09-08 11:20:12 -07:00
1 parent 675bf8bde2
commit 049ed79e7b
3 files changed
+17 -8

No files matched your search

@@ -505,12 +505,10 @@
}
public boolean m_5830_() {
@@ -3198,6 +_,64 @@
public void m_21190_(InteractionHand p_21191_) {
@@ -3200,6 +_,64 @@
this.m_21166_(p_21191_ == InteractionHand.MAIN_HAND ? EquipmentSlot.MAINHAND : EquipmentSlot.OFFHAND);
+ }
+
}
+ /* ==== FORGE START ==== */
+ /***
+ * Removes all potion effects that have curativeItem as a curative item for its effect
@@ -567,6 +565,17 @@
+ public void reviveCaps() {
+ super.reviveCaps();
+ handlers = net.minecraftforge.items.wrapper.EntityEquipmentInvWrapper.create(this);
+ }
+
public AABB m_6921_() {
if (this.m_6844_(EquipmentSlot.HEAD).m_150930_(Items.f_42683_)) {
float f = 0.5F;
@@ -3210,6 +_,8 @@
}
public AABB m_6921_() {
public static EquipmentSlot m_147233_(ItemStack p_147234_) {
+ final EquipmentSlot slot = p_147234_.getEquipmentSlot();
+ if (slot != null) return slot; // FORGE: Allow modders to set a non-default equipment slot for a stack; e.g. a non-armor chestplate-slot item
Item item = p_147234_.m_41720_();
if (!p_147234_.m_150930_(Items.f_42047_) && (!(item instanceof BlockItem) || !(((BlockItem)item).m_40614_() instanceof AbstractSkullBlock))) {
if (item instanceof ArmorItem) {
@@ -373,7 +373,7 @@ public interface IForgeItem
/**
* Override this to set a non-default armor slot for an ItemStack, but <em>do
* not use this to get the armor slot of said stack; for that, use
* {@link net.minecraft.entity.LivingEntity#getSlotForItemStack(ItemStack)}.</em>
* {@link net.minecraft.world.entity.LivingEntity#getEquipmentSlotForItem(ItemStack)}..</em>
*
* @param stack the ItemStack
* @return the armor slot of the ItemStack, or {@code null} to let the default
@@ -181,7 +181,7 @@ public interface IForgeItemStack extends ICapabilitySerializable<CompoundTag>
/**
* Override this to set a non-default armor slot for an ItemStack, but <em>do
* not use this to get the armor slot of said stack; for that, use
* {@link net.minecraft.entity.LivingEntity#getSlotForItemStack(ItemStack)}.</em>
* {@link net.minecraft.world.entity.LivingEntity#getEquipmentSlotForItem(ItemStack)}.</em>
*
* @return the armor slot of the ItemStack, or {@code null} to let the default
* vanilla logic as per {@code LivingEntity.getSlotForItemStack(stack)}