mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-17 19:05:31 +00:00
Fix #234 Backpacks not picking up ore dictionary items
This commit is contained in:
1 parent
afc3efbc61
commit
711b11f61e
5 files changed
+40
-51
No files matched your search
@@ -11,12 +11,13 @@
|
||||
package forestry.storage;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import forestry.core.utils.StackUtils;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.api.storage.IBackpackDefinition;
|
||||
import forestry.core.config.Defaults;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.StatCollector;
|
||||
@@ -70,17 +71,17 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
return secondaryColor;
|
||||
}
|
||||
|
||||
public BackpackDefinition setValidItems(ArrayList<ItemStack> validItems) {
|
||||
this.validItems = validItems;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addValidItem(ItemStack validItem) {
|
||||
if (validItem.getItem() != null)
|
||||
this.validItems.add(validItem);
|
||||
}
|
||||
|
||||
public void addValidItems(List<ItemStack> validItems) {
|
||||
for (ItemStack validItem : validItems)
|
||||
addValidItem(validItem);
|
||||
}
|
||||
|
||||
public ArrayList<ItemStack> getValidItems(EntityPlayer player) {
|
||||
return validItems;
|
||||
}
|
||||
@@ -88,12 +89,8 @@ public class BackpackDefinition implements IBackpackDefinition {
|
||||
@Override
|
||||
public boolean isValidItem(EntityPlayer player, ItemStack itemstack) {
|
||||
for (ItemStack stack : getValidItems(player))
|
||||
if (stack != null && stack.getItem() != null)
|
||||
if (stack.getItemDamage() == Defaults.WILDCARD) {
|
||||
if (stack.getItem() == itemstack.getItem())
|
||||
return true;
|
||||
} else if (stack.isItemEqual(itemstack))
|
||||
return true;
|
||||
if (StackUtils.isCraftingEquivalent(stack, itemstack, true, false))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user