Skip to content
This repository has been archived by the owner on Jun 23, 2024. It is now read-only.

Commit

Permalink
Don't suggest items with nbt tags for inventoryrecipes
Browse files Browse the repository at this point in the history
  • Loading branch information
gbl committed Mar 27, 2018
1 parent 16265f9 commit 2871deb
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,8 @@

import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import net.minecraft.block.Block;
import net.minecraft.block.BlockShulkerBox;
import net.minecraft.inventory.Container;
Expand Down Expand Up @@ -57,7 +55,17 @@ static List<IRecipe> findUnusualRecipes(Container inventory, int firstInventoryS
ItemStack stack=invitem.getStack();
Item item = stack.getItem();

if (item == Items.DYE) {
if (item.isRepairable() && stack.isItemDamaged()) {
NBTTagList enchantments = stack.getEnchantmentTagList();
if (enchantments.tagCount() <= ConfigurationHandler.getMaxEnchantsAllowedForRepair()) {
Integer previous=hasRepairable.get(item);
hasRepairable.put(item, previous == null ? 1 : previous+1);
}
}
else if (stack.hasTagCompound()) {
continue;
}
else if (item == Items.DYE) {
int dyeIndex=stack.getMetadata() & 15;
hasDye[dyeIndex]+=stack.getCount();
}
Expand Down Expand Up @@ -108,13 +116,6 @@ else if (item == Items.FILLED_MAP) {
else if (item == Items.MAP) {
hasMap=true;
}
else if (item.isRepairable() && stack.isItemDamaged()) {
NBTTagList enchantments = stack.getEnchantmentTagList();
if (enchantments.tagCount() <= ConfigurationHandler.getMaxEnchantsAllowedForRepair()) {
Integer previous=hasRepairable.get(item);
hasRepairable.put(item, previous == null ? 1 : previous+1);
}
}
}

System.out.print("hasDye: ");
Expand Down

0 comments on commit 2871deb

Please sign in to comment.