/** Checks if the region of a crafting inventory is match for the recipe. */ private boolean checkMatch(IInventory par1InventoryCrafting, int par2, int par3, boolean par4) { for (int var5 = 0; var5 < 3; ++var5) { for (int var6 = 0; var6 < 3; ++var6) { int var7 = var5 - par2; int var8 = var6 - par3; ItemStack var9 = null; if (var7 >= 0 && var8 >= 0 && var7 < this.recipeWidth && var8 < this.recipeHeight) { if (par4) { var9 = this.recipeItems[this.recipeWidth - var7 - 1 + var8 * this.recipeWidth]; } else { var9 = this.recipeItems[var7 + var8 * this.recipeWidth]; } } ItemStack var10 = ThaumcraftApiHelper.getStackInRowAndColumn(par1InventoryCrafting, var5, var6); if (var10 != null || var9 != null) { if (var10 == null && var9 != null || var10 != null && var9 == null) { return false; } if (var9.itemID != var10.itemID) { return false; } if (var9.getItemDamage() != -1 && var9.getItemDamage() != var10.getItemDamage()) { return false; } if (var9.hasTagCompound()) { NBTTagCompound tc = var9.getTagCompound(); for (Object tag : tc.getTags().toArray()) { NBTBase base = (NBTBase) tag; Class nc = NBTBase.newTag(base.getId(), base.getName()).getClass(); if (!(var10.hasTagCompound() && nc.cast(var10.getTagCompound().getTag(base.getName())) .equals(nc.cast(base)))) { return false; } } } } } } return true; }
private void checkValidInput() { boolean valid = true; kError = null; vError = null; if (canEditText && !validName()) { valid = false; kError = "Duplicate Tag Name"; } try { validValue(value.getText(), nbt.getId()); valid &= true; } catch (NumberFormatException e) { vError = e.getMessage(); valid = false; } save.enabled = valid; }
private static String getValue(NBTBase base) { switch (base.getId()) { case 7: String s = ""; for (byte b : ((NBTTagByteArray) base).getByteArray() /* byteArray */) { s += b + " "; } return s; case 9: return "TagList"; case 10: return "TagCompound"; case 11: String i = ""; for (int a : ((NBTTagIntArray) base).getIntArray() /* intArray */) { i += a + " "; } return i; default: return NBTStringHelper.toString(base); } }