Removed Chemical Combiner (hopefully all references)

This commit is contained in:
Aidan C. Brady 2014-01-01 16:21:55 -05:00
parent a07ca18997
commit 67d38fd179
12 changed files with 48 additions and 1029 deletions

View file

@ -1,84 +0,0 @@
package mekanism.api;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.FluidTank;
/**
* An input of one fluid and one gas for the Chemical Combiner.
* @author unpairedbracket
*
*/
public class ChemicalCombinerInput
{
/** The gas of this chemical combiner input */
public GasStack gas;
/** The fluid of this chemical combiner input */
public FluidStack fluid;
/**
* Creates a chemical input with two defined gasses of the Chemical Infuser.
* @param gas - gas
* @param fluid - fluid
*/
public ChemicalCombinerInput(GasStack gas, FluidStack fluid)
{
this.gas = gas;
this.fluid = fluid;
}
/**
* If this is a valid
* @return
*/
public boolean isValid()
{
return gas != null && fluid != null;
}
/**
* Whether or not the defined input contains the same chemicals and at least the required amount of the defined chemicals as this input.
* @param input - input to check
* @return if the input meets this input's requirements
*/
public boolean meetsInput(ChemicalCombinerInput input)
{
return meets(input);
}
/**
* Draws the needed amount of gas from each tank.
* @param gasTank - left tank to draw from
* @param fluidTank - right tank to draw from
*/
public void draw(GasTank gasTank, FluidTank fluidTank)
{
if(meets(new ChemicalCombinerInput(gasTank.getGas(), fluidTank.getFluid())))
{
gasTank.draw(gas.amount, true);
fluidTank.drain(fluid.amount, true);
}
}
/**
* Actual implementation of meetsInput(), performs the checks.
* @param input - input to check
* @return if the input meets this input's requirements
*/
private boolean meets(ChemicalCombinerInput input)
{
if(input == null || !input.isValid())
{
return false;
}
if(input.gas.getGas() != gas.getGas() || input.fluid.getFluid() != fluid.getFluid())
{
return false;
}
return input.gas.amount >= gas.amount && input.fluid.amount >= fluid.amount;
}
}

View file

@ -1,10 +1,8 @@
package mekanism.client;
import java.io.File;
import java.util.HashMap;
import mekanism.client.gui.GuiChemicalCombiner;
import mekanism.client.gui.GuiChemicalInfuser;
import mekanism.client.gui.GuiChemicalInjectionChamber;
import mekanism.client.gui.GuiChemicalOxidizer;
@ -81,7 +79,6 @@ import mekanism.common.tileentity.TileEntityAdvancedElectricMachine;
import mekanism.common.tileentity.TileEntityAdvancedFactory;
import mekanism.common.tileentity.TileEntityBin;
import mekanism.common.tileentity.TileEntityChargepad;
import mekanism.common.tileentity.TileEntityChemicalCombiner;
import mekanism.common.tileentity.TileEntityChemicalInfuser;
import mekanism.common.tileentity.TileEntityChemicalInjectionChamber;
import mekanism.common.tileentity.TileEntityChemicalOxidizer;
@ -276,7 +273,6 @@ public class ClientProxy extends CommonProxy
ClientRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter", new RenderTeleporter());
ClientRegistry.registerTileEntity(TileEntityChemicalOxidizer.class, "ChemicalOxidizer", new RenderChemicalOxidizer());
ClientRegistry.registerTileEntity(TileEntityChemicalInfuser.class, "ChemicalInfuser", new RenderChemicalInfuser());
GameRegistry.registerTileEntity(TileEntityChemicalCombiner.class, "ChemicalCombiner");
ClientRegistry.registerTileEntity(TileEntityChemicalInjectionChamber.class, "ChemicalInjectionChamber", new RenderConfigurableMachine());
}
@ -327,50 +323,50 @@ public class ClientProxy extends CommonProxy
case 1:
return new GuiCredits();
case 2:
return new GuiDigitalMiner(player.inventory, (TileEntityDigitalMiner) tileEntity);
return new GuiDigitalMiner(player.inventory, (TileEntityDigitalMiner)tileEntity);
case 3:
return new GuiEnrichmentChamber(player.inventory, (TileEntityElectricMachine) tileEntity);
return new GuiEnrichmentChamber(player.inventory, (TileEntityElectricMachine)tileEntity);
case 4:
return new GuiOsmiumCompressor(player.inventory, (TileEntityAdvancedElectricMachine) tileEntity);
return new GuiOsmiumCompressor(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 5:
return new GuiCombiner(player.inventory, (TileEntityAdvancedElectricMachine) tileEntity);
return new GuiCombiner(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 6:
return new GuiCrusher(player.inventory, (TileEntityElectricMachine) tileEntity);
return new GuiCrusher(player.inventory, (TileEntityElectricMachine)tileEntity);
case 7:
return new GuiRotaryCondensentrator(player.inventory, (TileEntityRotaryCondensentrator) tileEntity);
return new GuiRotaryCondensentrator(player.inventory, (TileEntityRotaryCondensentrator)tileEntity);
case 8:
return new GuiEnergyCube(player.inventory, (TileEntityEnergyCube) tileEntity);
return new GuiEnergyCube(player.inventory, (TileEntityEnergyCube)tileEntity);
case 9:
return new GuiConfiguration(player, (IInvConfiguration) tileEntity);
return new GuiConfiguration(player, (IInvConfiguration)tileEntity);
case 10:
return new GuiGasTank(player.inventory, (TileEntityGasTank) tileEntity);
return new GuiGasTank(player.inventory, (TileEntityGasTank)tileEntity);
case 11:
return new GuiFactory(player.inventory, (TileEntityFactory) tileEntity);
return new GuiFactory(player.inventory, (TileEntityFactory)tileEntity);
case 12:
return new GuiMetallurgicInfuser(player.inventory, (TileEntityMetallurgicInfuser) tileEntity);
return new GuiMetallurgicInfuser(player.inventory, (TileEntityMetallurgicInfuser)tileEntity);
case 13:
return new GuiTeleporter(player.inventory, (TileEntityTeleporter) tileEntity);
return new GuiTeleporter(player.inventory, (TileEntityTeleporter)tileEntity);
case 14:
ItemStack itemStack = player.getCurrentEquippedItem();
if (itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
if(itemStack != null && itemStack.getItem() instanceof ItemPortableTeleporter)
{
return new GuiPortableTeleporter(player, itemStack);
}
case 15:
return new GuiPurificationChamber(player.inventory, (TileEntityAdvancedElectricMachine) tileEntity);
return new GuiPurificationChamber(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 16:
return new GuiEnergizedSmelter(player.inventory, (TileEntityElectricMachine) tileEntity);
return new GuiEnergizedSmelter(player.inventory, (TileEntityElectricMachine)tileEntity);
case 17:
return new GuiElectricPump(player.inventory, (TileEntityElectricPump) tileEntity);
return new GuiElectricPump(player.inventory, (TileEntityElectricPump)tileEntity);
case 18:
return new GuiDynamicTank(player.inventory, (TileEntityDynamicTank) tileEntity);
return new GuiDynamicTank(player.inventory, (TileEntityDynamicTank)tileEntity);
case 19:
return new GuiPasswordEnter((TileEntityElectricChest) tileEntity);
return new GuiPasswordEnter((TileEntityElectricChest)tileEntity);
case 20:
return new GuiPasswordModify((TileEntityElectricChest) tileEntity);
return new GuiPasswordModify((TileEntityElectricChest)tileEntity);
case 21:
EntityRobit robit = (EntityRobit) world.getEntityByID(x);
EntityRobit robit = (EntityRobit)world.getEntityByID(x);
if(robit != null)
{
@ -379,14 +375,14 @@ public class ClientProxy extends CommonProxy
case 22:
return new GuiRobitCrafting(player.inventory, world, x);
case 23:
EntityRobit robit1 = (EntityRobit) world.getEntityByID(x);
EntityRobit robit1 = (EntityRobit)world.getEntityByID(x);
if(robit1 != null)
{
return new GuiRobitInventory(player.inventory, robit1);
}
case 24:
EntityRobit robit2 = (EntityRobit) world.getEntityByID(x);
EntityRobit robit2 = (EntityRobit)world.getEntityByID(x);
if(robit2 != null)
{
@ -395,13 +391,11 @@ public class ClientProxy extends CommonProxy
case 25:
return new GuiRobitRepair(player.inventory, world, x);
case 29:
return new GuiChemicalOxidizer(player.inventory, (TileEntityChemicalOxidizer) tileEntity);
return new GuiChemicalOxidizer(player.inventory, (TileEntityChemicalOxidizer)tileEntity);
case 30:
return new GuiChemicalInfuser(player.inventory, (TileEntityChemicalInfuser) tileEntity);
return new GuiChemicalInfuser(player.inventory, (TileEntityChemicalInfuser)tileEntity);
case 31:
return new GuiChemicalInjectionChamber(player.inventory, (TileEntityAdvancedElectricMachine) tileEntity);
case 32:
return new GuiChemicalCombiner(player.inventory, (TileEntityChemicalCombiner) tileEntity);
return new GuiChemicalInjectionChamber(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
}
return null;

View file

@ -1,186 +0,0 @@
package mekanism.client.gui;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.api.gas.GasStack;
import mekanism.client.render.MekanismRenderer;
import mekanism.common.PacketHandler;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.inventory.container.ContainerChemicalCombiner;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.tileentity.TileEntityChemicalCombiner;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GuiChemicalCombiner extends GuiMekanism
{
public TileEntityChemicalCombiner tileEntity;
public GuiChemicalCombiner(InventoryPlayer inventory, TileEntityChemicalCombiner tentity)
{
super(tentity, new ContainerChemicalCombiner(inventory, tentity));
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCombiner.png")));
}
@Override
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
{
int xAxis = (mouseX - (width - xSize) / 2);
int yAxis = (mouseY - (height - ySize) / 2);
fontRenderer.drawString(MekanismUtils.localize("gui.chemicalCombiner.short"), 5, 5, 0x404040);
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
if(xAxis >= 116 && xAxis <= 168 && yAxis >= 76 && yAxis <= 80)
{
drawCreativeTabHoveringText(MekanismUtils.getEnergyDisplay(tileEntity.getEnergy()), xAxis, yAxis);
}
if(xAxis >= 26 && xAxis <= 42 && yAxis >= 14 && yAxis <= 72)
{
drawCreativeTabHoveringText(tileEntity.gasTank.getGas() != null ? tileEntity.gasTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.gasTank.getStored() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
}
if(xAxis >= 134 && xAxis <= 150 && yAxis >= 14 && yAxis <= 72)
{
drawCreativeTabHoveringText(tileEntity.fluidTank.getFluid() != null ? tileEntity.fluidTank.getFluid().getFluid().getLocalizedName() + ": " + tileEntity.fluidTank.getFluidAmount() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
}
if(xAxis >= 80 && xAxis <= 96 && yAxis >= 5 && yAxis <= 63)
{
drawCreativeTabHoveringText(tileEntity.centerTank.getGas() != null ? tileEntity.centerTank.getGas().getGas().getLocalizedName() + ": " + tileEntity.centerTank.getStored() : MekanismUtils.localize("gui.empty"), xAxis, yAxis);
}
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
}
@Override
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
{
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCombiner.png"));
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
drawTexturedModalRect(guiWidth, guiHeight, 0, 0, xSize, ySize);
int xAxis = mouseX - guiWidth;
int yAxis = mouseY - guiHeight;
int displayInt;
displayInt = tileEntity.getScaledEnergyLevel(52);
drawTexturedModalRect(guiWidth + 116, guiHeight + 76, 176, 0, displayInt, 4);
if(tileEntity.isActive)
{
drawTexturedModalRect(guiWidth + 47, guiHeight + 39, 176, 71, 28, 8);
drawTexturedModalRect(guiWidth + 101, guiHeight + 39, 176, 63, 28, 8);
}
if(tileEntity.getScaledGasLevel(58) > 0)
{
displayGauge(26, 14, tileEntity.getScaledGasLevel(58), null, tileEntity.gasTank.getGas());
}
if(tileEntity.getScaledFluidLevel(58) > 0)
{
displayGauge(134, 14, tileEntity.getScaledFluidLevel(58), tileEntity.fluidTank.getFluid(), null);
}
if(tileEntity.getScaledOutputLevel(58) > 0)
{
displayGauge(80, 5, tileEntity.getScaledOutputLevel(58), null, tileEntity.centerTank.getGas());
}
}
@Override
protected void mouseClicked(int x, int y, int button)
{
super.mouseClicked(x, y, button);
if(button == 0)
{
int xAxis = (x - (width - xSize) / 2);
int yAxis = (y - (height - ySize) / 2);
if(xAxis > 44 && xAxis < 62 && yAxis > 13 && yAxis < 21)
{
ArrayList data = new ArrayList();
data.add(0);
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Coord4D.get(tileEntity), data));
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}
else if(xAxis > 114 && xAxis < 132 && yAxis > 13 && yAxis < 21)
{
ArrayList data = new ArrayList();
data.add(1);
PacketHandler.sendPacket(Transmission.SERVER, new PacketTileEntity().setParams(Coord4D.get(tileEntity), data));
mc.sndManager.playSoundFX("random.click", 1.0F, 1.0F);
}
}
}
public void displayGauge(int xPos, int yPos, int scale, FluidStack fluid, GasStack gas)
{
if(fluid == null && gas == null)
{
return;
}
int guiWidth = (width - xSize) / 2;
int guiHeight = (height - ySize) / 2;
int start = 0;
while(true)
{
int renderRemaining = 0;
if(scale > 16)
{
renderRemaining = 16;
scale -= 16;
}
else {
renderRemaining = scale;
scale = 0;
}
mc.renderEngine.bindTexture(MekanismRenderer.getBlocksTexture());
if(fluid != null)
{
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, fluid.getFluid().getIcon(), 16, 16 - (16 - renderRemaining));
}
else if(gas != null)
{
drawTexturedModelRectFromIcon(guiWidth + xPos, guiHeight + yPos + 58 - renderRemaining - start, gas.getGas().getIcon(), 16, 16 - (16 - renderRemaining));
}
start+=16;
if(renderRemaining == 0 || scale == 0)
{
break;
}
}
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalCombiner.png"));
drawTexturedModalRect(guiWidth + xPos, guiHeight + yPos, 176, 4, 16, 59);
}
}

View file

@ -58,7 +58,6 @@ public class CommonProxy
GameRegistry.registerTileEntity(TileEntityTeleporter.class, "MekanismTeleporter");
GameRegistry.registerTileEntity(TileEntityChemicalOxidizer.class, "ChemicalOxidizer");
GameRegistry.registerTileEntity(TileEntityChemicalInfuser.class, "ChemicalInfuser");
GameRegistry.registerTileEntity(TileEntityChemicalCombiner.class, "ChemicalCombiner");
GameRegistry.registerTileEntity(TileEntityChemicalInjectionChamber.class, "ChemicalInjectionChamber");
}
@ -158,7 +157,6 @@ public class CommonProxy
Mekanism.rotaryCondensentratorUsage = Mekanism.configuration.get("usage", "RotaryCondensentratorUsage", 50D).getDouble(50D);
Mekanism.oxidationChamberUsage = Mekanism.configuration.get("usage", "OxidationChamberUsage", 100D).getDouble(100D);
Mekanism.chemicalInfuserUsage = Mekanism.configuration.get("usage", "ChemicalInfuserUsage", 100D).getDouble(100D);
Mekanism.chemicalCombinerUsage = Mekanism.configuration.get("usage", "ChemicalCombinerUsage", 100D).getDouble(100D);
Mekanism.chemicalInjectionChamberUsage = Mekanism.configuration.get("usage", "ChemicalInjectionChamberUsage", 200D).getDouble(200D);
Mekanism.configuration.save();
}
@ -297,8 +295,6 @@ public class CommonProxy
return new ContainerChemicalInfuser(player.inventory, (TileEntityChemicalInfuser)tileEntity);
case 31:
return new ContainerAdvancedElectricMachine(player.inventory, (TileEntityAdvancedElectricMachine)tileEntity);
case 32:
return new ContainerChemicalCombiner(player.inventory, (TileEntityChemicalCombiner)tileEntity);
}
return null;

View file

@ -10,7 +10,6 @@ import java.util.Map;
import java.util.Set;
import java.util.logging.Logger;
import mekanism.api.ChemicalCombinerInput;
import mekanism.api.ChemicalInput;
import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
@ -97,6 +96,7 @@ import mekanism.common.network.PacketWalkieTalkieState;
import mekanism.common.tileentity.TileEntityAdvancedBoundingBlock;
import mekanism.common.tileentity.TileEntityBoundingBlock;
import mekanism.common.tileentity.TileEntityElectricBlock;
import mekanism.common.tileentity.TileEntityEnergizedSmelter;
import mekanism.common.transporter.TransporterManager;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
@ -111,8 +111,6 @@ import net.minecraftforge.common.Configuration;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import rebelkeithy.mods.metallurgy.api.IOreInfo;
@ -293,7 +291,6 @@ public class Mekanism
public static double rotaryCondensentratorUsage;
public static double oxidationChamberUsage;
public static double chemicalInfuserUsage;
public static double chemicalCombinerUsage;
public static double chemicalInjectionChamberUsage;
/**
@ -920,6 +917,23 @@ public class Mekanism
voiceManager.start();
}
//Load cached furnace recipes
TileEntityEnergizedSmelter.furnaceRecipes.clear();
for(Map.Entry<List<Integer>, ItemStack> entry : FurnaceRecipes.smelting().getMetaSmeltingList().entrySet())
{
TileEntityEnergizedSmelter.furnaceRecipes.put(new ItemStack(entry.getKey().get(0), 1, entry.getKey().get(1)), entry.getValue());
}
for(Object obj : FurnaceRecipes.smelting().getSmeltingList().entrySet())
{
if(obj instanceof Map.Entry)
{
Map.Entry<Integer, ItemStack> entry = (Map.Entry<Integer, ItemStack>)obj;
TileEntityEnergizedSmelter.furnaceRecipes.put(new ItemStack(entry.getKey(), 1, 0), entry.getValue());
}
}
event.registerServerCommand(new CommandMekanism());
}

View file

@ -3,7 +3,6 @@ package mekanism.common;
import java.util.HashMap;
import java.util.Map;
import mekanism.api.ChemicalCombinerInput;
import mekanism.api.ChemicalInput;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
@ -11,7 +10,6 @@ import mekanism.api.infuse.InfusionInput;
import mekanism.api.infuse.InfusionOutput;
import mekanism.common.util.StackUtils;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidTank;
/**
* Class used to handle machine recipes. This is used for both adding recipes and checking outputs.
@ -95,15 +93,6 @@ public final class RecipeHandler
Recipe.CHEMICAL_INFUSER.put(input, output);
}
/**
* Add a Chemical Combiner recipe
* @param input - input ChemicalCombinerInput
*/
public static void addChemicalCombinerRecipe(ChemicalCombinerInput input, GasStack output)
{
Recipe.CHEMICAL_COMBINER.put(input, output);
}
/**
* Add a Chemical Oxidizer recipe.
* @param input - input ItemStack
@ -191,40 +180,6 @@ public final class RecipeHandler
return null;
}
/**
* Gets the GasStack of the ChemicalCombinerInput in the parameters.
* @param gasTank - GasTank containing the gas to use
* @param fluidTank - FluidTank containing the fluid to use
* @param doRemove - actually drain the tanks
* @return output - GasStack returned
*/
public static GasStack getChemicalCombinerOutput(GasTank gasTank, FluidTank fluidTank, boolean doRemove)
{
ChemicalCombinerInput input = new ChemicalCombinerInput(gasTank.getGas(), fluidTank.getFluid());
if(input.isValid())
{
HashMap<ChemicalCombinerInput, GasStack> recipes = Recipe.CHEMICAL_COMBINER.get();
for(Map.Entry<ChemicalCombinerInput, GasStack> entry : recipes.entrySet())
{
ChemicalCombinerInput key = (ChemicalCombinerInput)entry.getKey();
if(key.meetsInput(input))
{
if(doRemove)
{
key.draw(gasTank, fluidTank);
}
return entry.getValue().copy();
}
}
}
return null;
}
/**
* Gets the InfusionOutput of the ItemStack in the parameters.
@ -320,7 +275,6 @@ public final class RecipeHandler
PURIFICATION_CHAMBER(new HashMap<ItemStack, ItemStack>()),
METALLURGIC_INFUSER(new HashMap<InfusionInput, InfusionOutput>()),
CHEMICAL_INFUSER(new HashMap<ChemicalInput, GasStack>()),
CHEMICAL_COMBINER(new HashMap<ChemicalCombinerInput, GasStack>()),
CHEMICAL_OXIDIZER(new HashMap<ItemStack, GasStack>()),
CHEMICAL_INJECTION_CHAMBER(new HashMap<ItemStack, ItemStack>());

View file

@ -1091,8 +1091,7 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
ROTARY_CONDENSENTRATOR(Mekanism.machineBlock2ID, 0, "RotaryCondensentrator", 7, 20000, TileEntityRotaryCondensentrator.class, true),
CHEMICAL_OXIDIZER(Mekanism.machineBlock2ID, 1, "ChemicalOxidizer", 29, 20000, TileEntityChemicalOxidizer.class, true),
CHEMICAL_INFUSER(Mekanism.machineBlock2ID, 2, "ChemicalInfuser", 30, 20000, TileEntityChemicalInfuser.class, true),
CHEMICAL_COMBINER(Mekanism.machineBlock2ID, 3, "ChemicalCombiner", 32, 20000, TileEntityChemicalCombiner.class, false),
CHEMICAL_INJECTION_CHAMBER(Mekanism.machineBlock2ID, 4, "ChemicalInjectionChamber", 31, Mekanism.chemicalInjectionChamberUsage*400, TileEntityChemicalInjectionChamber.class, false);
CHEMICAL_INJECTION_CHAMBER(Mekanism.machineBlock2ID, 3, "ChemicalInjectionChamber", 31, Mekanism.chemicalInjectionChamberUsage*400, TileEntityChemicalInjectionChamber.class, false);
public int typeId;
public int meta;

View file

@ -1,147 +0,0 @@
package mekanism.common.inventory.container;
import mekanism.api.gas.IGasItem;
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
import mekanism.common.inventory.slot.SlotStorageTank;
import mekanism.common.item.ItemMachineUpgrade;
import mekanism.common.tileentity.TileEntityChemicalCombiner;
import mekanism.common.tileentity.TileEntityChemicalInfuser;
import mekanism.common.util.ChargeUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerChemicalCombiner extends Container
{
private TileEntityChemicalCombiner tileEntity;
public ContainerChemicalCombiner(InventoryPlayer inventory, TileEntityChemicalCombiner tentity)
{
tileEntity = tentity;
addSlotToContainer(new SlotStorageTank(tentity, null, true, 0, 5, 56));
addSlotToContainer(new SlotStorageTank(tentity, null, true, 1, 155, 56));
addSlotToContainer(new Slot(tentity, 2, 80, 65));
addSlotToContainer(new SlotDischarge(tentity, 3, 155, 5));
int slotX;
for(slotX = 0; slotX < 3; slotX++)
{
for(int slotY = 0; slotY < 9; slotY++)
{
addSlotToContainer(new Slot(inventory, slotY + slotX * 9 + 9, 8 + slotY * 18, 84 + slotX * 18));
}
}
for(slotX = 0; slotX < 9; ++slotX)
{
addSlotToContainer(new Slot(inventory, slotX, 8 + slotX * 18, 142));
}
tileEntity.open(inventory.player);
tileEntity.openChest();
}
@Override
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onContainerClosed(entityplayer);
tileEntity.close(entityplayer);
tileEntity.closeChest();
}
@Override
public boolean canInteractWith(EntityPlayer entityplayer)
{
return tileEntity.isUseableByPlayer(entityplayer);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID)
{
ItemStack stack = null;
Slot currentSlot = (Slot)inventorySlots.get(slotID);
if(currentSlot != null && currentSlot.getHasStack())
{
ItemStack slotStack = currentSlot.getStack();
stack = slotStack.copy();
if(ChargeUtils.canBeDischarged(slotStack))
{
if(slotID != 3)
{
if(!mergeItemStack(slotStack, 3, 4, false))
{
return null;
}
}
else if(slotID == 3)
{
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
else if(slotStack.getItem() instanceof IGasItem)
{
if(slotID != 0 && slotID != 1 && slotID != 2)
{
if(!mergeItemStack(slotStack, 0, 3, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 5, inventorySlots.size(), true))
{
return null;
}
}
}
else {
if(slotID >= 4 && slotID <= 30)
{
if(!mergeItemStack(slotStack, 31, inventorySlots.size(), false))
{
return null;
}
}
else if(slotID > 30)
{
if(!mergeItemStack(slotStack, 4, 30, false))
{
return null;
}
}
else {
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
{
return null;
}
}
}
if(slotStack.stackSize == 0)
{
currentSlot.putStack((ItemStack)null);
}
else {
currentSlot.onSlotChanged();
}
if(slotStack.stackSize == stack.stackSize)
{
return null;
}
currentSlot.onPickupFromSlot(player, slotStack);
}
return stack;
}
}

View file

@ -504,7 +504,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
MachineType type = MachineType.get((ItemStack)data[0]);
if(type != MachineType.TELEPORTER && type != MachineType.ELECTRIC_PUMP && type != MachineType.ELECTRIC_CHEST && type != MachineType.CHARGEPAD && type != MachineType.LOGISTICAL_SORTER &&
type != MachineType.ROTARY_CONDENSENTRATOR && type != MachineType.CHEMICAL_OXIDIZER && type != MachineType.CHEMICAL_INFUSER && type != MachineType.CHEMICAL_COMBINER)
type != MachineType.ROTARY_CONDENSENTRATOR && type != MachineType.CHEMICAL_OXIDIZER && type != MachineType.CHEMICAL_INFUSER)
{
return true;
}

View file

@ -1,507 +0,0 @@
package mekanism.common.tileentity;
import java.util.ArrayList;
import mekanism.api.Coord4D;
import mekanism.api.gas.Gas;
import mekanism.api.gas.GasRegistry;
import mekanism.api.gas.GasStack;
import mekanism.api.gas.GasTank;
import mekanism.api.gas.GasTransmission;
import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.IGasItem;
import mekanism.api.gas.ITubeConnection;
import mekanism.common.*;
import mekanism.common.PacketHandler.Transmission;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import com.google.common.io.ByteArrayDataInput;
import net.minecraftforge.fluids.*;
public class TileEntityChemicalCombiner extends TileEntityElectricBlock implements IActiveState, IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandler
{
public GasTank gasTank = new GasTank(MAX);
public FluidTank fluidTank = new FluidTank(MAX);
public GasTank centerTank = new GasTank(MAX);
public static final int MAX = 10000;
public int updateDelay;
public int gasOutput = 16;
public boolean isActive;
public boolean clientActive;
public double prevEnergy;
public final double ENERGY_USAGE = Mekanism.chemicalCombinerUsage;
/** This machine's current RedstoneControl type. */
public RedstoneControl controlType = RedstoneControl.DISABLED;
public TileEntityChemicalCombiner()
{
super("ChemicalCombiner", MachineType.CHEMICAL_COMBINER.baseEnergy);
inventory = new ItemStack[4];
}
@Override
public void onUpdate()
{
if(worldObj.isRemote)
{
if(updateDelay > 0)
{
updateDelay--;
if(updateDelay == 0 && clientActive != isActive)
{
isActive = clientActive;
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
}
}
}
if(!worldObj.isRemote)
{
if(updateDelay > 0)
{
updateDelay--;
if(updateDelay == 0 && clientActive != isActive)
{
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList())));
}
}
ChargeUtils.discharge(3, this);
if(inventory[0] != null && (gasTank.getGas() == null || gasTank.getStored() < gasTank.getMaxGas()))
{
gasTank.receive(GasTransmission.removeGas(inventory[0], null, gasTank.getNeeded()), true);
}
if(inventory[1] != null && (fluidTank.getFluid() == null || fluidTank.getFluidAmount() < fluidTank.getCapacity()))
{
if(inventory[1].getItem() instanceof IFluidContainerItem)
{
fluidTank.fill(((IFluidContainerItem) inventory[1].getItem()).drain(inventory[1], fluidTank.getCapacity()-fluidTank.getFluidAmount(), true), true);
}
else if(FluidContainerRegistry.isFilledContainer(inventory[1]) && FluidContainerRegistry.getFluidForFilledItem(inventory[1]).equals(fluidTank.getFluid()))
{
fluidTank.fill(FluidContainerRegistry.getFluidForFilledItem(inventory[1]), true);
inventory[1] = inventory[1].getItem().getContainerItemStack(inventory[1]);
}
}
if(inventory[2] != null && centerTank.getGas() != null)
{
centerTank.draw(GasTransmission.addGas(inventory[2], centerTank.getGas()), true);
}
if(canOperate() && getEnergy() >= ENERGY_USAGE && MekanismUtils.canFunction(this))
{
setActive(true);
GasStack stack = RecipeHandler.getChemicalCombinerOutput(gasTank, fluidTank, true);
centerTank.receive(stack, true);
setEnergy(getEnergy() - ENERGY_USAGE);
}
else {
if(prevEnergy >= getEnergy())
{
setActive(false);
}
}
if(centerTank.getGas() != null)
{
GasStack toSend = new GasStack(centerTank.getGas().getGas(), Math.min(centerTank.getStored(), gasOutput));
centerTank.draw(GasTransmission.emitGasToNetwork(toSend, this, ForgeDirection.getOrientation(facing)), true);
TileEntity tileEntity = Coord4D.get(this).getFromSide(ForgeDirection.getOrientation(facing)).getTileEntity(worldObj);
if(tileEntity instanceof IGasHandler)
{
if(((IGasHandler)tileEntity).canReceiveGas(ForgeDirection.getOrientation(facing).getOpposite(), centerTank.getGas().getGas()))
{
centerTank.draw(((IGasHandler)tileEntity).receiveGas(ForgeDirection.getOrientation(facing).getOpposite(), toSend), true);
}
}
}
prevEnergy = getEnergy();
}
}
public boolean canOperate()
{
if(gasTank.getGas() == null || fluidTank.getFluid() == null || centerTank.getNeeded() == 0)
{
return false;
}
GasStack out = RecipeHandler.getChemicalCombinerOutput(gasTank, fluidTank, false);
if(out == null)
{
return false;
}
if(centerTank.getNeeded() < out.amount)
{
return false;
}
return true;
}
@Override
public void handlePacketData(ByteArrayDataInput dataStream)
{
if(!worldObj.isRemote)
{
int type = dataStream.readInt();
if(type == 0)
{
gasTank.setGas(null);
}
else if(type == 1)
{
fluidTank.setFluid(null);
}
for(EntityPlayer player : playersUsing)
{
PacketHandler.sendPacket(Transmission.SINGLE_CLIENT, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList())), player);
}
return;
}
super.handlePacketData(dataStream);
isActive = dataStream.readBoolean();
controlType = RedstoneControl.values()[dataStream.readInt()];
if(dataStream.readBoolean())
{
gasTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt()));
}
else {
gasTank.setGas(null);
}
if(dataStream.readBoolean())
{
fluidTank.setFluid(new FluidStack(FluidRegistry.getFluid(dataStream.readInt()), dataStream.readInt()));
}
else {
fluidTank.setFluid(null);
}
if(dataStream.readBoolean())
{
centerTank.setGas(new GasStack(GasRegistry.getGas(dataStream.readInt()), dataStream.readInt()));
}
else {
centerTank.setGas(null);
}
MekanismUtils.updateBlock(worldObj, xCoord, yCoord, zCoord);
}
@Override
public ArrayList getNetworkedData(ArrayList data)
{
super.getNetworkedData(data);
data.add(isActive);
data.add(controlType.ordinal());
if(gasTank.getGas() != null)
{
data.add(true);
data.add(gasTank.getGas().getGas().getID());
data.add(gasTank.getStored());
}
else {
data.add(false);
}
if(fluidTank.getFluid() != null)
{
data.add(true);
data.add(fluidTank.getFluid().getFluid().getID());
data.add(fluidTank.getFluidAmount());
}
else {
data.add(false);
}
if(centerTank.getGas() != null)
{
data.add(true);
data.add(centerTank.getGas().getGas().getID());
data.add(centerTank.getStored());
}
else {
data.add(false);
}
return data;
}
@Override
public void readFromNBT(NBTTagCompound nbtTags)
{
super.readFromNBT(nbtTags);
isActive = nbtTags.getBoolean("isActive");
controlType = RedstoneControl.values()[nbtTags.getInteger("controlType")];
gasTank.read(nbtTags.getCompoundTag("gasTank"));
fluidTank.readFromNBT(nbtTags.getCompoundTag("fluidTank"));
centerTank.read(nbtTags.getCompoundTag("centerTank"));
}
@Override
public void writeToNBT(NBTTagCompound nbtTags)
{
super.writeToNBT(nbtTags);
nbtTags.setBoolean("isActive", isActive);
nbtTags.setInteger("controlType", controlType.ordinal());
nbtTags.setCompoundTag("gasTank", gasTank.write(new NBTTagCompound()));
nbtTags.setCompoundTag("fluidTank", fluidTank.writeToNBT(new NBTTagCompound()));
nbtTags.setCompoundTag("centerTank", centerTank.write(new NBTTagCompound()));
}
@Override
public boolean canSetFacing(int i)
{
return i != 0 && i != 1;
}
public GasTank getGasTank(ForgeDirection side)
{
if(side == MekanismUtils.getLeft(facing))
{
return gasTank;
}
else if(side == ForgeDirection.getOrientation(facing))
{
return centerTank;
}
return null;
}
public FluidTank getFluidTank(ForgeDirection side)
{
if(side == MekanismUtils.getRight(facing))
{
return fluidTank;
}
return null;
}
public int getScaledGasLevel(int i)
{
return gasTank != null ? gasTank.getStored()*i / MAX : 0;
}
public int getScaledFluidLevel(int i)
{
return fluidTank != null ? fluidTank.getFluidAmount()*i / MAX : 0;
}
public int getScaledOutputLevel(int i)
{
return centerTank != null ? centerTank.getStored()*i / MAX : 0;
}
@Override
public void setActive(boolean active)
{
isActive = active;
if(clientActive != active && updateDelay == 0)
{
PacketHandler.sendPacket(Transmission.ALL_CLIENTS, new PacketTileEntity().setParams(Coord4D.get(this), getNetworkedData(new ArrayList())));
updateDelay = 10;
clientActive = active;
}
}
@Override
public boolean getActive()
{
return isActive;
}
@Override
public boolean renderUpdate()
{
return false;
}
@Override
public boolean lightUpdate()
{
return true;
}
@Override
public boolean canTubeConnect(ForgeDirection side)
{
return side == MekanismUtils.getLeft(facing) || side == MekanismUtils.getRight(facing) || side == ForgeDirection.getOrientation(facing);
}
@Override
public boolean canReceiveGas(ForgeDirection side, Gas type)
{
return getGasTank(side) != null && getGasTank(side) != centerTank ? getGasTank(side).canReceive(type) : false;
}
@Override
public RedstoneControl getControlType()
{
return controlType;
}
@Override
public void setControlType(RedstoneControl type)
{
controlType = type;
MekanismUtils.saveChunk(this);
}
@Override
public int receiveGas(ForgeDirection side, GasStack stack)
{
if(canReceiveGas(side, stack != null ? stack.getGas() : null))
{
return getGasTank(side).receive(stack, true);
}
return 0;
}
@Override
public GasStack drawGas(ForgeDirection side, int amount)
{
if(canDrawGas(side, null))
{
return getGasTank(side).draw(amount, true);
}
return null;
}
@Override
public boolean canDrawGas(ForgeDirection side, Gas type)
{
return getGasTank(side) != null && getGasTank(side) == centerTank ? getGasTank(side).canDraw(type) : false;
}
@Override
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
{
if(slotID == 3)
{
return ChargeUtils.canBeDischarged(itemstack);
}
return false;
}
@Override
public boolean canExtractItem(int slotID, ItemStack itemstack, int side)
{
if(slotID == 0)
{
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canReceiveGas(itemstack, null);
}
if(slotID == 1)
{
return itemstack != null && itemstack.getItem() instanceof IGasItem && ((IGasItem)itemstack.getItem()).canProvideGas(itemstack, null);
}
return false;
}
@Override
public int[] getAccessibleSlotsFromSide(int side)
{
if(side == MekanismUtils.getLeft(facing).ordinal())
{
return new int[] {0};
}
else if(side == facing)
{
return new int[] {1};
}
else if(side == MekanismUtils.getRight(facing).ordinal())
{
return new int[] {2};
}
else if(side == 0 || side == 1)
{
return new int[3];
}
return InventoryUtils.EMPTY;
}
@Override
public int fill(ForgeDirection side, FluidStack resource, boolean doFill) {
return getFluidTank(side) == null ? 0 : getFluidTank(side).fill(resource, doFill);
}
@Override
public FluidStack drain(ForgeDirection side, FluidStack resource, boolean doDrain) {
return getFluidTank(side) == null && getFluidTank(side).getFluid().isFluidEqual(resource) ? null : getFluidTank(side).drain(resource.amount, doDrain);
}
@Override
public FluidStack drain(ForgeDirection side, int maxDrain, boolean doDrain) {
return getFluidTank(side) == null ? null : getFluidTank(side).drain(maxDrain, doDrain);
}
@Override
public boolean canFill(ForgeDirection side, Fluid fluid) {
return getFluidTank(side) != null && (getFluidTank(side).getFluid() == null || getFluidTank(side).getFluid().getFluid() == fluid);
}
@Override
public boolean canDrain(ForgeDirection side, Fluid fluid) {
return getFluidTank(side) != null && getFluidTank(side).getFluid().getFluid() == fluid;
}
@Override
public FluidTankInfo[] getTankInfo(ForgeDirection side) {
if(getFluidTank(side) == null)
{
return new FluidTankInfo[0];
}
return new FluidTankInfo[] {new FluidTankInfo(getFluidTank(side))};
}
}

View file

@ -12,6 +12,8 @@ import net.minecraft.util.ResourceLocation;
public class TileEntityEnergizedSmelter extends TileEntityElectricMachine
{
public static Map<ItemStack, ItemStack> furnaceRecipes = new HashMap<ItemStack, ItemStack>();
public TileEntityEnergizedSmelter()
{
super("Smelter.ogg", "EnergizedSmelter", new ResourceLocation("mekanism", "gui/GuiEnergizedSmelter.png"), Mekanism.energizedSmelterUsage, 200, MachineType.ENERGIZED_SMELTER.baseEnergy);
@ -20,22 +22,6 @@ public class TileEntityEnergizedSmelter extends TileEntityElectricMachine
@Override
public Map getRecipes()
{
HashMap<ItemStack, ItemStack> map = new HashMap<ItemStack, ItemStack>();
for(Map.Entry<List<Integer>, ItemStack> entry : FurnaceRecipes.smelting().getMetaSmeltingList().entrySet())
{
map.put(new ItemStack(entry.getKey().get(0), 1, entry.getKey().get(1)), entry.getValue());
}
for(Object obj : FurnaceRecipes.smelting().getSmeltingList().entrySet())
{
if(obj instanceof Map.Entry)
{
Map.Entry<Integer, ItemStack> entry = (Map.Entry<Integer, ItemStack>)obj;
map.put(new ItemStack(entry.getKey(), 1, 0), entry.getValue());
}
}
return map;
return furnaceRecipes;
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB