Worked on ore processor

Added option to turn off animation
Fixed inventory update issue
Fixed Lang file names
This commit is contained in:
DarkGuardsman 2013-09-21 16:57:33 -04:00
parent 4b37d90795
commit 7abe19e96d
6 changed files with 32 additions and 13 deletions

View file

@ -10,6 +10,7 @@ tile.crate.name=Crate
tile.crate.0.name=Basic Crate
tile.crate.1.name=Advanced Crate
tile.crate.2.name=Elite Crate
tile.conveyorBelt.name=Conveyor Belt
tile.imprinter.name=Imprinter
tile.encoder.name=Encoder
@ -19,7 +20,12 @@ tile.craneController.name=Crane Controller
tile.craneFrame.name=Crane Frame
tile.manipulator.name=Manipulator
tile.rejector.name=Rejector
tile.turntable.name=Turntable
tile.turntable.name=Turn Table
tile.OreProcessor.0.name = Ore Crusher
tile.OreProcessor.4.name = Ore Grinder
tile.OreProcessor.8.name = Metal Press
tile.OreProcessor.12.name = Mold Injector
# Items
item.imprint.name=Imprint

View file

@ -74,7 +74,7 @@ public class ClientProxy extends CommonProxy
{
return new GuiEncoder(player.inventory, (TileEntityEncoder) tileEntity);
}
case GUI_CRUSHER:
case GUI_PROCESSOR:
{
return new GuiProcessor(player.inventory, (TileEntityProcessor) tileEntity);
}

View file

@ -22,7 +22,7 @@ public class CommonProxy implements IGuiHandler
{
public static final int GUI_IMPRINTER = 1;
public static final int GUI_ENCODER = 2;
public static final int GUI_CRUSHER = 3;
public static final int GUI_PROCESSOR = 3;
public void preInit()
{
@ -111,7 +111,7 @@ public class CommonProxy implements IGuiHandler
if (tileEntity != null && tileEntity instanceof TileEntityEncoder)
return new ContainerEncoder(player.inventory, (TileEntityEncoder) tileEntity);
}
case GUI_CRUSHER:
case GUI_PROCESSOR:
{
return new ContainerProcessor(player.inventory, (TileEntityProcessor) tileEntity);
}

View file

@ -13,6 +13,8 @@ import net.minecraft.world.World;
import net.minecraftforge.common.Configuration;
import net.minecraftforge.oredict.OreDictionary;
import universalelectricity.core.UniversalElectricity;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import dark.api.ProcessorRecipes.ProcessorType;
@ -45,7 +47,7 @@ public class BlockProcessor extends BlockMachine implements IExtraObjectInfo
}
else
{
entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_CRUSHER, world, x, y, z);
entityPlayer.openGui(AssemblyLine.instance, CommonProxy.GUI_PROCESSOR, world, x, y, z);
return true;
}
}
@ -94,6 +96,10 @@ public class BlockProcessor extends BlockMachine implements IExtraObjectInfo
data.allowCrafting = config.get(data.unlocalizedName, "CanCraft", true).getBoolean(true);
data.wattPerTick = (float) (config.get(data.unlocalizedName, "WattPerTick", data.wattPerTick).getDouble(data.wattPerTick) / 1000);
data.processingTicks = config.get(data.unlocalizedName, "ProcessingTicks", data.processingTicks).getInt();
if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
{
data.doAnimation = config.get(data.unlocalizedName, "DoAnimation", true).getBoolean(true);
}
}
}
@ -176,14 +182,15 @@ public class BlockProcessor extends BlockMachine implements IExtraObjectInfo
public static enum ProcessorData
{
CRUSHER(ProcessorType.CRUSHER, "crusher", 125, 100, 0),
GRINDER(ProcessorType.GRINDER, "grinder", 125, 120, 4),
PRESS(ProcessorType.PRESS, "press", 200, 50, 8);
GRINDER(ProcessorType.GRINDER, "grinder", 125, 120, 4);
//PRESS(ProcessorType.PRESS, "press", 200, 50, 8);
public ProcessorType type;
public String unlocalizedName;
public float wattPerTick;
public int processingTicks, startMeta;
public boolean enabled = true;
public boolean allowCrafting = true;
public boolean doAnimation = true;
private ProcessorData(ProcessorType type, String name, float watts, int ticks, int meta)
{

View file

@ -128,7 +128,7 @@ public class ContainerProcessor extends Container
}
else if (slotID != 1 && slotID != 0)
{
if (ProcessorRecipes.getOuput(tileEntity.getProcessorData().type, slotStack) != null)
if (ProcessorRecipes.getOuput(tileEntity.getProcessorData().type, slotStack, true) != null)
{
if (!this.mergeItemStack(slotStack, tileEntity.slotInput, 1, false))
{

View file

@ -17,7 +17,7 @@ import dark.core.prefab.invgui.InvChest;
import dark.core.prefab.machine.TileEntityEnergyMachine;
/** Basic A -> B recipe processor machine designed mainly to handle ore blocks
*
*
* @author DarkGuardsman */
public class TileEntityProcessor extends TileEntityEnergyMachine
{
@ -53,7 +53,10 @@ public class TileEntityProcessor extends TileEntityEnergyMachine
super.updateEntity();
if (this.isFunctioning())
{
this.doAnimation();
if (this.processorData.doAnimation)
{
this.doAnimation();
}
if (!this.worldObj.isRemote)
{
@ -72,6 +75,7 @@ public class TileEntityProcessor extends TileEntityEnergyMachine
{
this.getInventory().setInventorySlotContents(this.slotOutput, outputBuffer[i].copy());
outputBuffer[i] = null;
this.onInventoryChanged();
}
else if (outputBuffer[i] != null && outputBuffer[i].isItemEqual(outputStack))
{
@ -92,7 +96,9 @@ public class TileEntityProcessor extends TileEntityEnergyMachine
}
this.getInventory().setInventorySlotContents(this.slotOutput, outStack);
this.onInventoryChanged();
}
}
if (nullCount >= outputBuffer.length)
{
@ -151,7 +157,7 @@ public class TileEntityProcessor extends TileEntityEnergyMachine
{
inputStack = inputStack.copy();
inputStack.stackSize = 1;
ItemStack[] outputResult = ProcessorRecipes.getOuput(this.getProcessorData().type, inputStack);
ItemStack[] outputResult = ProcessorRecipes.getOuput(this.getProcessorData().type, inputStack, true);
if (outputResult != null)
{
if (outputStack == null)
@ -185,7 +191,7 @@ public class TileEntityProcessor extends TileEntityEnergyMachine
inputSlotStack = inputSlotStack.copy();
inputSlotStack.stackSize = 1;
ItemStack[] receipeResult = ProcessorRecipes.getOuput(this.getProcessorData().type, inputSlotStack);
ItemStack[] receipeResult = ProcessorRecipes.getOuput(this.getProcessorData().type, inputSlotStack, true);
if (receipeResult != null && this.outputBuffer == null)
{
this.getInventory().decrStackSize(this.slotInput, 1);
@ -207,7 +213,7 @@ public class TileEntityProcessor extends TileEntityEnergyMachine
@Override
public boolean canStore(ItemStack stack, int slot, ForgeDirection side)
{
if (slotInput == slot && ProcessorRecipes.getOuput(this.getProcessorData().type, stack) != null)
if (slotInput == slot && ProcessorRecipes.getOuput(this.getProcessorData().type, stack, true) != null)
{
return true;
}