Finished initial tag testing for altar recipes

This commit is contained in:
WayofTime 2014-11-14 17:23:45 -05:00
parent 9935197282
commit 37c6feeb6b
2 changed files with 39 additions and 13 deletions

View file

@ -5,6 +5,7 @@ import java.util.Set;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
public class AltarRecipe
{
@ -66,22 +67,42 @@ public class AltarRecipe
NBTTagCompound comparedTag = comparedStack.getTagCompound();
Set set = tag.func_150296_c();
for(Object obj : set)
{
if(obj instanceof String)
{
String str = (String)obj;
NBTBase baseTag = comparedTag.getTag(str);
if(baseTag != null && !baseTag.equals(comparedTag.getTag(str)))
return this.areTagsEqual(tag, comparedTag);
}
return true;
}
protected boolean areTagsEqual(NBTTagCompound tag, NBTTagCompound comparedTag)
{
Set set = tag.func_150296_c();
for(Object obj : set)
{
if(obj instanceof String)
{
String str = (String)obj;
NBTBase baseTag = comparedTag.getTag(str);
if(baseTag instanceof NBTTagCompound)
{
NBTBase comparedBaseTag = comparedTag.getTag(str);
if(comparedBaseTag instanceof NBTTagCompound)
{
if(!this.areTagsEqual((NBTTagCompound) tag, comparedTag))
{
return false;
}
}
}else
{
if(baseTag != null && !baseTag.equals(comparedTag.getTag(str)))
{
return false;
}
}
}
}
}
}
return true;

View file

@ -13,6 +13,11 @@ public class AltarRecipeRegistry
{
altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled));
}
public static void registerNBTAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled)
{
altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, true));
}
public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate)
{