mirror of
https://github.com/Thorfusion/Mekanism-Community-Edition.git
synced 2026-11-27 23:33:08 +00:00
*Merged all machines into a single class. *Merged all machines to use a single block ID. *Set up a new machine recipe system to take in 2 itemstacks instead of 1 int and 1 itemstack. *Updated machine field names. *Removed old block classes, including BlockCombiner, BlockCrusher, BlockEnrichmentChamber, and BlockPlatinumCompressor. *Removed old machine recipe classes. *Removed sound system, will come at a later date. *Set up a new ore handling system. *Updated configuration for new IDs (3000-3003). *Set up new GUI IDs to replace old random ones. *Updated javadocs. *Updated machine facing system. *Implemented IWrenchable in TileEntityMachine, IC2 wrenches can change facing of machines now. *Added macerator recipes for more OI items. *Added IC2 mass fabricator boost with Enriched Alloy (100,000 ticks). *Updated IC2 hooks system. *Removed unnecessary imports. *Updated a bunch of recipes, check them out on PMC. *Updated metadata IDs in MultiBlock. *Updated machine overall code.
164 lines
4.7 KiB
Java
164 lines
4.7 KiB
Java
package net.uberkat.obsidian.common;
|
|
|
|
import net.minecraft.src.*;
|
|
|
|
public class ContainerCombiner extends Container
|
|
{
|
|
private TileEntityCombiner machine;
|
|
private int lastCookTime = 0;
|
|
private int lastBurnTime = 0;
|
|
private int lastItemBurnTime = 0;
|
|
|
|
public ContainerCombiner(InventoryPlayer par1InventoryPlayer, TileEntityCombiner par2TileEntityCombiner)
|
|
{
|
|
this.machine = par2TileEntityCombiner;
|
|
this.addSlotToContainer(new Slot(par2TileEntityCombiner, 0, 56, 17));
|
|
this.addSlotToContainer(new Slot(par2TileEntityCombiner, 1, 56, 53));
|
|
this.addSlotToContainer(new SlotFurnace(par1InventoryPlayer.player, par2TileEntityCombiner, 2, 116, 35));
|
|
int var3;
|
|
|
|
for (var3 = 0; var3 < 3; ++var3)
|
|
{
|
|
for (int var4 = 0; var4 < 9; ++var4)
|
|
{
|
|
this.addSlotToContainer(new Slot(par1InventoryPlayer, var4 + var3 * 9 + 9, 8 + var4 * 18, 84 + var3 * 18));
|
|
}
|
|
}
|
|
|
|
for (var3 = 0; var3 < 9; ++var3)
|
|
{
|
|
this.addSlotToContainer(new Slot(par1InventoryPlayer, var3, 8 + var3 * 18, 142));
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Updates crafting matrix; called from onCraftMatrixChanged. Args: none
|
|
*/
|
|
public void updateCraftingResults()
|
|
{
|
|
super.updateCraftingResults();
|
|
|
|
for (int var1 = 0; var1 < this.crafters.size(); ++var1)
|
|
{
|
|
ICrafting var2 = (ICrafting)this.crafters.get(var1);
|
|
|
|
if (this.lastCookTime != this.machine.machineCookTime)
|
|
{
|
|
var2.updateCraftingInventoryInfo(this, 0, this.machine.machineCookTime);
|
|
}
|
|
|
|
if (this.lastBurnTime != this.machine.machineBurnTime)
|
|
{
|
|
var2.updateCraftingInventoryInfo(this, 1, this.machine.machineBurnTime);
|
|
}
|
|
|
|
if (this.lastItemBurnTime != this.machine.currentItemBurnTime)
|
|
{
|
|
var2.updateCraftingInventoryInfo(this, 2, this.machine.currentItemBurnTime);
|
|
}
|
|
}
|
|
|
|
this.lastCookTime = this.machine.machineCookTime;
|
|
this.lastBurnTime = this.machine.machineBurnTime;
|
|
this.lastItemBurnTime = this.machine.currentItemBurnTime;
|
|
}
|
|
|
|
public void updateProgressBar(int par1, int par2)
|
|
{
|
|
if (par1 == 0)
|
|
{
|
|
this.machine.machineCookTime = par2;
|
|
}
|
|
|
|
if (par1 == 1)
|
|
{
|
|
this.machine.machineBurnTime = par2;
|
|
}
|
|
|
|
if (par1 == 2)
|
|
{
|
|
this.machine.currentItemBurnTime = par2;
|
|
}
|
|
}
|
|
|
|
public boolean canInteractWith(EntityPlayer par1EntityPlayer)
|
|
{
|
|
return this.machine.isUseableByPlayer(par1EntityPlayer);
|
|
}
|
|
|
|
/**
|
|
* Called to transfer a stack from one inventory to the other eg. when shift clicking.
|
|
*/
|
|
public ItemStack transferStackInSlot(int par1)
|
|
{
|
|
ItemStack var2 = null;
|
|
Slot var3 = (Slot)this.inventorySlots.get(par1);
|
|
|
|
if (var3 != null && var3.getHasStack())
|
|
{
|
|
ItemStack var4 = var3.getStack();
|
|
var2 = var4.copy();
|
|
|
|
if (par1 == 2)
|
|
{
|
|
if (!this.mergeItemStack(var4, 3, 39, true))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var3.onSlotChange(var4, var2);
|
|
}
|
|
else if (par1 != 1 && par1 != 0)
|
|
{
|
|
if (MachineRecipes.getOutput(var4, false, machine.recipes) != null)
|
|
{
|
|
if (!this.mergeItemStack(var4, 0, 1, false))
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
else if (TileEntityCombiner.isItemFuel(var4))
|
|
{
|
|
if (!this.mergeItemStack(var4, 1, 2, false))
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
else if (par1 >= 3 && par1 < 30)
|
|
{
|
|
if (!this.mergeItemStack(var4, 30, 39, false))
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
else if (par1 >= 30 && par1 < 39 && !this.mergeItemStack(var4, 3, 30, false))
|
|
{
|
|
return null;
|
|
}
|
|
}
|
|
else if (!this.mergeItemStack(var4, 3, 39, false))
|
|
{
|
|
return null;
|
|
}
|
|
|
|
if (var4.stackSize == 0)
|
|
{
|
|
var3.putStack((ItemStack)null);
|
|
}
|
|
else
|
|
{
|
|
var3.onSlotChanged();
|
|
}
|
|
|
|
if (var4.stackSize == var2.stackSize)
|
|
{
|
|
return null;
|
|
}
|
|
|
|
var3.onPickupFromSlot(var4);
|
|
}
|
|
|
|
return var2;
|
|
}
|
|
}
|