public ContainerWorkbench(InventoryPlayer par1InventoryPlayer, World par2World, int par3, int par4, int par5) { CraftMatrix = new InventoryCrafting(this, 3, 3); CraftResult = new InventoryCraftResult(); WorldObj = par2World; PosX = par3; PosY = par4; PosZ = par5; AddSlot(new SlotCrafting(par1InventoryPlayer.Player, CraftMatrix, CraftResult, 0, 124, 35)); for (int i = 0; i < 3; i++) { for (int l = 0; l < 3; l++) { AddSlot(new Slot(CraftMatrix, l + i * 3, 30 + l * 18, 17 + i * 18)); } } for (int j = 0; j < 3; j++) { for (int i1 = 0; i1 < 9; i1++) { AddSlot(new Slot(par1InventoryPlayer, i1 + j * 9 + 9, 8 + i1 * 18, 84 + j * 18)); } } for (int k = 0; k < 9; k++) { AddSlot(new Slot(par1InventoryPlayer, k, 8 + k * 18, 142)); } OnCraftMatrixChanged(CraftMatrix); }
public CraftingInventoryWorkbenchCB(InventoryPlayer inventoryplayer, World world, int i, int j, int k) { craftMatrix = new InventoryCrafting(this, 3, 3); craftResult = new InventoryCraftResult(); field_20150_c = world; field_20149_h = i; field_20148_i = j; field_20147_j = k; addSlot(new SlotCrafting(craftMatrix, craftResult, 0, 124, 35)); for (int l = 0; l < 3; l++) { for (int k1 = 0; k1 < 3; k1++) { addSlot(new Slot(craftMatrix, k1 + l * 3, 30 + k1 * 18, 17 + l * 18)); } } for (int i1 = 0; i1 < 3; i1++) { for (int l1 = 0; l1 < 9; l1++) { addSlot(new Slot(inventoryplayer, l1 + i1 * 9 + 9, 8 + l1 * 18, 84 + i1 * 18)); } } for (int j1 = 0; j1 < 9; j1++) { addSlot(new Slot(inventoryplayer, j1, 8 + j1 * 18, 142)); } onCraftMatrixChanged(craftMatrix); }
public CraftingInventoryWorkbenchCB(InventoryPlayer inventoryplayer, World world, int i, int j, int k) { craftMatrix = new InventoryCrafting(this, 3, 3); craftResult = new InventoryCraftResult(); field_20150_c = world; field_20149_h = i; field_20148_i = j; field_20147_j = k; addSlot(new SlotCrafting(craftMatrix, craftResult, 0, 124, 35)); for (int l = 0; l < 3; l++) { for (int k1 = 0; k1 < 3; k1++) { addSlot(new Slot(craftMatrix, k1 + l*3, 30 + k1*18, 17 + l*18)); } } for (int i1 = 0; i1 < 3; i1++) { for (int l1 = 0; l1 < 9; l1++) { addSlot(new Slot(inventoryplayer, l1 + i1*9 + 9, 8 + l1*18, 84 + i1*18)); } } for (int j1 = 0; j1 < 9; j1++) { addSlot(new Slot(inventoryplayer, j1, 8 + j1*18, 142)); } onCraftMatrixChanged(craftMatrix); }
/// <summary> /// Checks if the region of a crafting inventory is match for the recipe. /// </summary> private bool CheckMatch(InventoryCrafting par1InventoryCrafting, int par2, int par3, bool par4) { for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { int k = i - par2; int l = j - par3; ItemStack itemstack = null; if (k >= 0 && l >= 0 && k < RecipeWidth && l < RecipeHeight) { if (par4) { itemstack = RecipeItems[(RecipeWidth - k - 1) + l * RecipeWidth]; } else { itemstack = RecipeItems[k + l * RecipeWidth]; } } ItemStack itemstack1 = par1InventoryCrafting.GetStackInRowAndColumn(i, j); if (itemstack1 == null && itemstack == null) { continue; } if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) { return(false); } if (itemstack.ItemID != itemstack1.ItemID) { return(false); } if (itemstack.GetItemDamage() != -1 && itemstack.GetItemDamage() != itemstack1.GetItemDamage()) { return(false); } } } return(true); }
public bool func_21134_a(InventoryCrafting inventorycrafting) { for (int i = 0; i <= 3 - field_21140_b; i++) { for (int j = 0; j <= 3 - field_21144_c; j++) { if (func_21139_a(inventorycrafting, i, j, true)) { return(true); } if (func_21139_a(inventorycrafting, i, j, false)) { return(true); } } } return(false); }
private bool func_21139_a(InventoryCrafting inventorycrafting, int i, int j, bool flag) { for (int k = 0; k < 3; k++) { for (int l = 0; l < 3; l++) { int i1 = k - i; int j1 = l - j; ItemStack itemstack = null; if (i1 >= 0 && j1 >= 0 && i1 < field_21140_b && j1 < field_21144_c) { if (flag) { itemstack = field_21143_d[(field_21140_b - i1 - 1) + j1 * field_21140_b]; } else { itemstack = field_21143_d[i1 + j1 * field_21140_b]; } } ItemStack itemstack1 = inventorycrafting.func_21084_a(k, l); if (itemstack1 == null && itemstack == null) { continue; } if (itemstack1 == null && itemstack != null || itemstack1 != null && itemstack == null) { return(false); } if (itemstack.itemID != itemstack1.itemID) { return(false); } if (itemstack.getItemDamage() != -1 && itemstack.getItemDamage() != itemstack1.getItemDamage()) { return(false); } } } return(true); }
/// <summary> /// Used to check if a recipe matches current crafting inventory /// </summary> public virtual bool Matches(InventoryCrafting par1InventoryCrafting) { for (int i = 0; i <= 3 - RecipeWidth; i++) { for (int j = 0; j <= 3 - RecipeHeight; j++) { if (CheckMatch(par1InventoryCrafting, i, j, true)) { return(true); } if (CheckMatch(par1InventoryCrafting, i, j, false)) { return(true); } } } return(false); }
public ContainerPlayer(InventoryPlayer par1InventoryPlayer, bool par2) { CraftMatrix = new InventoryCrafting(this, 2, 2); CraftResult = new InventoryCraftResult(); IsLocalWorld = false; IsLocalWorld = par2; AddSlot(new SlotCrafting(par1InventoryPlayer.Player, CraftMatrix, CraftResult, 0, 144, 36)); for (int i = 0; i < 2; i++) { for (int i1 = 0; i1 < 2; i1++) { AddSlot(new Slot(CraftMatrix, i1 + i * 2, 88 + i1 * 18, 26 + i * 18)); } } for (int j = 0; j < 4; j++) { int j1 = j; AddSlot(new SlotArmor(this, par1InventoryPlayer, par1InventoryPlayer.GetSizeInventory() - 1 - j, 8, 8 + j * 18, j1)); } for (int k = 0; k < 3; k++) { for (int k1 = 0; k1 < 9; k1++) { AddSlot(new Slot(par1InventoryPlayer, k1 + (k + 1) * 9, 8 + k1 * 18, 84 + k * 18)); } } for (int l = 0; l < 9; l++) { AddSlot(new Slot(par1InventoryPlayer, l, 8 + l * 18, 142)); } OnCraftMatrixChanged(CraftMatrix); }
public CraftingInventoryPlayerCB(InventoryPlayer inventoryplayer, bool flag) { craftMatrix = new InventoryCrafting(this, 2, 2); craftResult = new InventoryCraftResult(); isMP = false; isMP = flag; addSlot(new SlotCrafting(craftMatrix, craftResult, 0, 144, 36)); for (int i = 0; i < 2; i++) { for (int i1 = 0; i1 < 2; i1++) { addSlot(new Slot(craftMatrix, i1 + i * 2, 88 + i1 * 18, 26 + i * 18)); } } for (int j = 0; j < 4; j++) { int j1 = j; addSlot(new SlotArmor(this, inventoryplayer, inventoryplayer.getSizeInventory() - 1 - j, 8, 8 + j * 18, j1)); } for (int k = 0; k < 3; k++) { for (int k1 = 0; k1 < 9; k1++) { addSlot(new Slot(inventoryplayer, k1 + (k + 1) * 9, 8 + k1 * 18, 84 + k * 18)); } } for (int l = 0; l < 9; l++) { addSlot(new Slot(inventoryplayer, l, 8 + l * 18, 142)); } onCraftMatrixChanged(craftMatrix); }
public CraftingInventoryPlayerCB(InventoryPlayer inventoryplayer, bool flag) { craftMatrix = new InventoryCrafting(this, 2, 2); craftResult = new InventoryCraftResult(); isMP = false; isMP = flag; addSlot(new SlotCrafting(craftMatrix, craftResult, 0, 144, 36)); for (int i = 0; i < 2; i++) { for (int i1 = 0; i1 < 2; i1++) { addSlot(new Slot(craftMatrix, i1 + i*2, 88 + i1*18, 26 + i*18)); } } for (int j = 0; j < 4; j++) { int j1 = j; addSlot(new SlotArmor(this, inventoryplayer, inventoryplayer.getSizeInventory() - 1 - j, 8, 8 + j*18, j1)); } for (int k = 0; k < 3; k++) { for (int k1 = 0; k1 < 9; k1++) { addSlot(new Slot(inventoryplayer, k1 + (k + 1)*9, 8 + k1*18, 84 + k*18)); } } for (int l = 0; l < 9; l++) { addSlot(new Slot(inventoryplayer, l, 8 + l*18, 142)); } onCraftMatrixChanged(craftMatrix); }
/// <summary> /// Returns an Item that is the result of this recipe /// </summary> public virtual ItemStack GetCraftingResult(InventoryCrafting par1InventoryCrafting) { return(new ItemStack(RecipeOutput.ItemID, RecipeOutput.StackSize, RecipeOutput.GetItemDamage())); }
public ItemStack func_21136_b(InventoryCrafting inventorycrafting) { return(new ItemStack(field_21142_e.itemID, field_21142_e.stackSize, field_21142_e.getItemDamage())); }