Get PRC functionality going.
This commit is contained in:
parent
fef2d30194
commit
57c08078f8
17 changed files with 560 additions and 119 deletions
|
@ -1,7 +1,5 @@
|
|||
package mekanism.api;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
|
||||
|
@ -9,17 +7,14 @@ import net.minecraft.item.ItemStack;
|
|||
|
||||
public class PressurizedProducts
|
||||
{
|
||||
private static Random rand = new Random();
|
||||
|
||||
private ItemStack probabilityOutput;
|
||||
private double probability;
|
||||
private ItemStack itemOutput;
|
||||
|
||||
private GasStack gasOutput;
|
||||
|
||||
public PressurizedProducts(ItemStack item, double chance, GasStack gas)
|
||||
public PressurizedProducts(ItemStack item, GasStack gas)
|
||||
{
|
||||
probabilityOutput = item;
|
||||
probability = chance;
|
||||
itemOutput = item;
|
||||
gasOutput = gas;
|
||||
}
|
||||
|
||||
|
@ -28,12 +23,31 @@ public class PressurizedProducts
|
|||
tank.receive(gasOutput, true);
|
||||
}
|
||||
|
||||
public void addProducts(ItemStack itemStack)
|
||||
public void addProducts(ItemStack[] inventory, int index)
|
||||
{
|
||||
if(itemStack.isItemEqual(probabilityOutput) && rand.nextDouble() <= probability)
|
||||
if(inventory[index] == null)
|
||||
{
|
||||
itemStack.stackSize += probabilityOutput.stackSize;
|
||||
inventory[index] = itemOutput.copy();
|
||||
}
|
||||
else if(inventory[index].isItemEqual(itemOutput))
|
||||
{
|
||||
inventory[index].stackSize += itemOutput.stackSize;
|
||||
}
|
||||
}
|
||||
|
||||
public ItemStack getOptionalOutput()
|
||||
{
|
||||
return itemOutput;
|
||||
}
|
||||
|
||||
public GasStack getGasOutput()
|
||||
{
|
||||
return gasOutput;
|
||||
}
|
||||
|
||||
public PressurizedProducts copy()
|
||||
{
|
||||
return new PressurizedProducts(itemOutput.copy(), gasOutput.copy());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -93,6 +93,11 @@ public class PressurizedReactants
|
|||
return stack.isGasEqual(theGas);
|
||||
}
|
||||
|
||||
public boolean meetsInput(ItemStack itemStack, FluidStack fluidStack, GasStack gasStack)
|
||||
{
|
||||
return meets(new PressurizedReactants(itemStack, fluidStack, gasStack));
|
||||
}
|
||||
|
||||
/**
|
||||
* Actual implementation of meetsInput(), performs the checks.
|
||||
* @param input - input to check
|
||||
|
@ -105,7 +110,7 @@ public class PressurizedReactants
|
|||
return false;
|
||||
}
|
||||
|
||||
if(StackUtils.equalsWildcard(input.theSolid, theSolid) || input.theFluid.getFluid() != theFluid.getFluid() || input.theGas.getGas() != theGas.getGas())
|
||||
if(!(StackUtils.equalsWildcard(input.theSolid, theSolid) && input.theFluid.isFluidEqual(theFluid) && input.theGas.isGasEqual(theGas)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -115,7 +120,7 @@ public class PressurizedReactants
|
|||
|
||||
public PressurizedReactants copy()
|
||||
{
|
||||
return new PressurizedReactants(theSolid, theFluid, theGas);
|
||||
return new PressurizedReactants(theSolid.copy(), theFluid.copy(), theGas.copy());
|
||||
}
|
||||
|
||||
}
|
||||
|
|
25
common/mekanism/api/PressurizedRecipe.java
Normal file
25
common/mekanism/api/PressurizedRecipe.java
Normal file
|
@ -0,0 +1,25 @@
|
|||
package mekanism.api;
|
||||
|
||||
public class PressurizedRecipe
|
||||
{
|
||||
public PressurizedReactants reactants;
|
||||
|
||||
public double extraEnergy;
|
||||
|
||||
public PressurizedProducts products;
|
||||
|
||||
public int ticks;
|
||||
|
||||
public PressurizedRecipe(PressurizedReactants pressurizedReactants, double energy, PressurizedProducts pressurizedProducts, int duration)
|
||||
{
|
||||
reactants = pressurizedReactants;
|
||||
extraEnergy = energy;
|
||||
products = pressurizedProducts;
|
||||
ticks = duration;
|
||||
}
|
||||
|
||||
public PressurizedRecipe copy()
|
||||
{
|
||||
return new PressurizedRecipe(reactants.copy(), extraEnergy, products.copy(), ticks);
|
||||
}
|
||||
}
|
|
@ -90,7 +90,7 @@ public class GasTank
|
|||
{
|
||||
if(stored == null)
|
||||
{
|
||||
stored = amount;
|
||||
stored = amount.copy();
|
||||
}
|
||||
else {
|
||||
stored.amount = Math.min(getMaxGas(), getStored()+amount.amount);
|
||||
|
|
|
@ -27,6 +27,7 @@ import mekanism.client.gui.GuiFactory;
|
|||
import mekanism.client.gui.GuiGasTank;
|
||||
import mekanism.client.gui.GuiMetallurgicInfuser;
|
||||
import mekanism.client.gui.GuiOsmiumCompressor;
|
||||
import mekanism.client.gui.GuiPRC;
|
||||
import mekanism.client.gui.GuiPasswordEnter;
|
||||
import mekanism.client.gui.GuiPasswordModify;
|
||||
import mekanism.client.gui.GuiPortableTeleporter;
|
||||
|
@ -115,6 +116,7 @@ import mekanism.common.tile.TileEntityLogisticalSorter;
|
|||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityObsidianTNT;
|
||||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.tile.TileEntityPrecisionSawmill;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
|
@ -316,6 +318,7 @@ public class ClientProxy extends CommonProxy
|
|||
ClientRegistry.registerTileEntity(TileEntityChemicalDissolutionChamber.class, "ChemicalDissolutionChamber", new RenderChemicalDissolutionChamber());
|
||||
ClientRegistry.registerTileEntity(TileEntityChemicalWasher.class, "ChemicalWasher", new RenderChemicalWasher());
|
||||
ClientRegistry.registerTileEntity(TileEntityChemicalCrystalizer.class, "ChemicalCrystalizer", new RenderChemicalCrystalizer());
|
||||
GameRegistry.registerTileEntity(TileEntityPRC.class, "PressurizedReactionChamber");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -461,6 +464,8 @@ public class ClientProxy extends CommonProxy
|
|||
}
|
||||
case 39:
|
||||
return new GuiSeismicVibrator(player.inventory, (TileEntitySeismicVibrator)tileEntity);
|
||||
case 40:
|
||||
return new GuiPRC(player.inventory, (TileEntityPRC)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
54
common/mekanism/client/gui/GuiPRC.java
Normal file
54
common/mekanism/client/gui/GuiPRC.java
Normal file
|
@ -0,0 +1,54 @@
|
|||
package mekanism.client.gui;
|
||||
|
||||
import mekanism.common.inventory.container.ContainerPRC;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
* Created by ben on 05/04/14.
|
||||
*/
|
||||
public class GuiPRC extends GuiMekanism
|
||||
{
|
||||
public TileEntityPRC tileEntity;
|
||||
|
||||
public GuiPRC(InventoryPlayer inventory, TileEntityPRC tentity)
|
||||
{
|
||||
super(tentity, new ContainerPRC(inventory, tentity));
|
||||
tileEntity = tentity;
|
||||
|
||||
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png")));
|
||||
guiElements.add(new GuiPowerBar(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.png"), 164, 15));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int mouseX, int mouseY)
|
||||
{
|
||||
int xAxis = (mouseX - (width - xSize) / 2);
|
||||
int yAxis = (mouseY - (height - ySize) / 2);
|
||||
|
||||
fontRenderer.drawString(tileEntity.getInvName(), 45, 6, 0x404040);
|
||||
fontRenderer.drawString(MekanismUtils.localize("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
|
||||
|
||||
super.drawGuiContainerForegroundLayer(mouseX, mouseY);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float partialTick, int mouseX, int mouseY)
|
||||
{
|
||||
mc.renderEngine.bindTexture(MekanismUtils.getResource(ResourceType.GUI, "GuiPRC.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;
|
||||
|
||||
super.drawGuiContainerBackgroundLayer(partialTick, mouseX, mouseY);
|
||||
}
|
||||
|
||||
}
|
|
@ -80,6 +80,7 @@ public class MekanismRenderer
|
|||
GasRegistry.getGas("hydrogenChloride").setIcon(event.map.registerIcon("mekanism:LiquidHydrogenChloride"));
|
||||
GasRegistry.getGas("liquidOsmium").setIcon(event.map.registerIcon("mekanism:LiquidOsmium"));
|
||||
GasRegistry.getGas("liquidStone").setIcon(event.map.registerIcon("mekanism:LiquidStone"));
|
||||
GasRegistry.getGas("ethene").setIcon(event.map.registerIcon("mekanism:Ethene"));
|
||||
|
||||
for(Gas gas : GasRegistry.getRegisteredGasses())
|
||||
{
|
||||
|
|
|
@ -23,6 +23,7 @@ import mekanism.common.inventory.container.ContainerFilter;
|
|||
import mekanism.common.inventory.container.ContainerGasTank;
|
||||
import mekanism.common.inventory.container.ContainerMetallurgicInfuser;
|
||||
import mekanism.common.inventory.container.ContainerNull;
|
||||
import mekanism.common.inventory.container.ContainerPRC;
|
||||
import mekanism.common.inventory.container.ContainerRobitCrafting;
|
||||
import mekanism.common.inventory.container.ContainerRobitInventory;
|
||||
import mekanism.common.inventory.container.ContainerRobitMain;
|
||||
|
@ -63,6 +64,7 @@ import mekanism.common.tile.TileEntityLogisticalSorter;
|
|||
import mekanism.common.tile.TileEntityMetallurgicInfuser;
|
||||
import mekanism.common.tile.TileEntityObsidianTNT;
|
||||
import mekanism.common.tile.TileEntityOsmiumCompressor;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
import mekanism.common.tile.TileEntityPrecisionSawmill;
|
||||
import mekanism.common.tile.TileEntityPurificationChamber;
|
||||
import mekanism.common.tile.TileEntityRotaryCondensentrator;
|
||||
|
@ -209,7 +211,7 @@ public class CommonProxy
|
|||
Mekanism.TO_IC2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EUToJoules", .1D).getDouble(.1D);
|
||||
Mekanism.FROM_BC = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "JoulesToMJ", 25D).getDouble(25D);
|
||||
Mekanism.TO_BC = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "MJToJoules", .04D).getDouble(.04D);
|
||||
Mekanism.FROM_H2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HydrogenEnergyDensity", 200D).getDouble(200D);
|
||||
Mekanism.FROM_H2 = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "HydrogenEnergyDensity", 18250D).getDouble(18250D);
|
||||
Mekanism.ENERGY_PER_REDSTONE = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "EnergyPerRedstone", 10000D).getDouble(10000D);
|
||||
Mekanism.VOICE_PORT = Mekanism.configuration.get(Configuration.CATEGORY_GENERAL, "VoicePort", 36123).getInt();
|
||||
//If this is less than 1, upgrades make machines worse. If less than 0, I don't even know.
|
||||
|
@ -244,6 +246,7 @@ public class CommonProxy
|
|||
Mekanism.chemicalWasherUsage = Mekanism.configuration.get("usage", "ChemicalWasherUsage", 200D).getDouble(200D);
|
||||
Mekanism.chemicalCrystalizerUsage = Mekanism.configuration.get("usage", "ChemicalCrystalizerUsage", 400D).getDouble(400D);
|
||||
Mekanism.seismicVibratorUsage = Mekanism.configuration.get("usage", "SeismicVibratorUsage", 50D).getDouble(50D);
|
||||
Mekanism.pressurizedReactionBaseUsage = Mekanism.configuration.get("usage", "PressurizedReactionBaseUsage", 5D).getDouble(5D);
|
||||
Mekanism.configuration.save();
|
||||
}
|
||||
|
||||
|
@ -395,6 +398,8 @@ public class CommonProxy
|
|||
return new ContainerChemicalCrystalizer(player.inventory, (TileEntityChemicalCrystalizer)tileEntity);
|
||||
case 39:
|
||||
return new ContainerSeismicVibrator(player.inventory, (TileEntitySeismicVibrator)tileEntity);
|
||||
case 40:
|
||||
return new ContainerPRC(player.inventory, (TileEntityPRC)tileEntity);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -17,6 +17,8 @@ import mekanism.api.Coord4D;
|
|||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.MekanismAPI;
|
||||
import mekanism.api.MekanismAPI.BoxBlacklistEvent;
|
||||
import mekanism.api.PressurizedProducts;
|
||||
import mekanism.api.PressurizedReactants;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasNetwork.GasTransferEvent;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
|
@ -123,6 +125,8 @@ import mekanism.common.transporter.TransporterManager;
|
|||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.common.util.MekanismUtils.ResourceType;
|
||||
import mekanism.common.voice.VoiceServerManager;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
@ -136,11 +140,14 @@ import net.minecraftforge.event.world.ChunkEvent;
|
|||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
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;
|
||||
import rebelkeithy.mods.metallurgy.api.MetallurgyAPI;
|
||||
import codechicken.multipart.handler.MultipartProxy;
|
||||
import scala.tools.nsc.backend.icode.Primitives;
|
||||
|
||||
import cpw.mods.fml.common.FMLLog;
|
||||
import cpw.mods.fml.common.IFuelHandler;
|
||||
import cpw.mods.fml.common.Mod;
|
||||
|
@ -267,6 +274,9 @@ public class Mekanism
|
|||
public static ItemJetpack ArmoredJetpack;
|
||||
public static Item FilterCard;
|
||||
public static ItemSeismicReader SeismicReader;
|
||||
public static Item Substrate;
|
||||
public static Item Polyethene;
|
||||
public static Item BioFuel;
|
||||
|
||||
//Blocks
|
||||
public static Block BasicBlock;
|
||||
|
@ -345,7 +355,7 @@ public class Mekanism
|
|||
public static double chemicalWasherUsage;
|
||||
public static double chemicalCrystalizerUsage;
|
||||
public static double seismicVibratorUsage;
|
||||
public static double pressurizedReactionUsage;
|
||||
public static double pressurizedReactionBaseUsage;
|
||||
|
||||
/**
|
||||
* Adds all in-game crafting and smelting recipes.
|
||||
|
@ -704,8 +714,19 @@ public class Mekanism
|
|||
RecipeHandler.addCrusherRecipe(new ItemStack(Block.stoneBrick, 1, 3), new ItemStack(Block.stoneBrick, 1, 0));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.flint, 4), new ItemStack(Item.gunpowder));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Block.sandStone), new ItemStack(Block.sand, 2));
|
||||
//BioFuel Crusher Recipes
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Block.tallGrass), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.reed), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.seeds), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.wheat), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.pumpkinSeeds), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.melonSeeds), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.appleRed), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.bread), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.potato), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.carrot), new ItemStack(BioFuel, 4));
|
||||
|
||||
//Purification Chamber Recipes
|
||||
//Purification Chamber Recipes
|
||||
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.obsidian), new ItemStack(Clump, 3, 6));
|
||||
RecipeHandler.addPurificationChamberRecipe(new ItemStack(Block.gravel), new ItemStack(Item.flint));
|
||||
|
||||
|
@ -765,8 +786,24 @@ public class Mekanism
|
|||
//Chemical Dissolution Chamber Recipes
|
||||
RecipeHandler.addChemicalDissolutionChamberRecipe(new ItemStack(Block.obsidian), new GasStack(GasRegistry.getGas("obsidian"), 1000));
|
||||
|
||||
//Pressurized Reaction Chamber Recipes
|
||||
RecipeHandler.addPRCRecipe(
|
||||
new PressurizedReactants(new ItemStack(BioFuel, 2), new FluidStack(FluidRegistry.WATER, 10), new GasStack(GasRegistry.getGas("hydrogen"), 100)),
|
||||
new PressurizedProducts(new ItemStack(Substrate), new GasStack(GasRegistry.getGas("ethene"), 100)),
|
||||
0,
|
||||
100
|
||||
);
|
||||
|
||||
RecipeHandler.addPRCRecipe(
|
||||
new PressurizedReactants(new ItemStack(Substrate), new FluidStack(FluidRegistry.getFluid("ethene"), 50), new GasStack(GasRegistry.getGas("oxygen"), 10)),
|
||||
new PressurizedProducts(new ItemStack(Polyethene), new GasStack(GasRegistry.getGas("oxygen"), 5)),
|
||||
1000,
|
||||
60
|
||||
);
|
||||
|
||||
//Infuse objects
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10));
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(BioFuel), new InfuseObject(InfuseRegistry.get("BIO"), 5));
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 0), new InfuseObject(InfuseRegistry.get("CARBON"), 10));
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(Item.coal, 1, 1), new InfuseObject(InfuseRegistry.get("CARBON"), 20));
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(CompressedCarbon), new InfuseObject(InfuseRegistry.get("CARBON"), 100));
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(Item.redstone), new InfuseObject(InfuseRegistry.get("REDSTONE"), 10));
|
||||
|
@ -835,6 +872,9 @@ public class Mekanism
|
|||
Robit = (ItemRobit)new ItemRobit(configuration.getItem("Robit", ITEM_ID++).getInt()).setUnlocalizedName("Robit");
|
||||
Balloon = new ItemBalloon(configuration.getItem("Balloon", ITEM_ID++).getInt()).setUnlocalizedName("Balloon");
|
||||
ItemProxy = new ItemProxy(configuration.getItem("ItemProxy", ITEM_ID++).getInt()).setUnlocalizedName("ItemProxy");
|
||||
Substrate = new ItemMekanism(configuration.getItem("Substrate", ITEM_ID++).getInt()).setUnlocalizedName("Substrate");
|
||||
Polyethene = new ItemMekanism(configuration.getItem("HDPE", ITEM_ID++).getInt()).setUnlocalizedName("HDPE");
|
||||
BioFuel = new ItemMekanism(Mekanism.configuration.getItem("BioFuel", ITEM_ID++).getInt()).setUnlocalizedName("BioFuel");
|
||||
|
||||
configuration.save();
|
||||
|
||||
|
@ -879,6 +919,9 @@ public class Mekanism
|
|||
GameRegistry.registerItem(ArmoredJetpack, "ArmoredJetpack");
|
||||
GameRegistry.registerItem(FilterCard, "FilterCard");
|
||||
GameRegistry.registerItem(SeismicReader, "SeismicReader");
|
||||
GameRegistry.registerItem(Substrate, "Substrate");
|
||||
GameRegistry.registerItem(Polyethene, "Polyethene");
|
||||
GameRegistry.registerItem(BioFuel, "BioFuel");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -983,6 +1026,7 @@ public class Mekanism
|
|||
|
||||
OreDictionary.registerOre("itemCompressedCarbon", new ItemStack(CompressedCarbon));
|
||||
OreDictionary.registerOre("itemEnrichedAlloy", new ItemStack(EnrichedAlloy));
|
||||
OreDictionary.registerOre("itemBioFuel", new ItemStack(BioFuel));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1146,6 +1190,7 @@ public class Mekanism
|
|||
GasRegistry.register(new Gas("hydrogenChloride")).registerFluid();
|
||||
GasRegistry.register(new Gas("liquidOsmium").setVisible(false));
|
||||
GasRegistry.register(new Gas("liquidStone").setVisible(false));
|
||||
GasRegistry.register(new Gas("ethene").registerFluid());
|
||||
|
||||
for(Resource resource : Resource.values())
|
||||
{
|
||||
|
|
|
@ -112,6 +112,8 @@ import cpw.mods.fml.relauncher.SideOnly;
|
|||
* 1:6: Chemical Dissolution Chamber
|
||||
* 1:7: Chemical Washer
|
||||
* 1:8: Chemical Crystalizer
|
||||
* 1:9: Seismic Vibrator
|
||||
* 1:10: Pressurized Reaction Chamber
|
||||
* @author AidanBrady
|
||||
*
|
||||
*/
|
||||
|
@ -176,7 +178,8 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
icons[5][2] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[9][0] = register.registerIcon("mekanism:SteelBlock");
|
||||
icons[9][1] = register.registerIcon("mekanism:SeismicVibrator");
|
||||
icons[10][0] = register.registerIcon("mekanism:PressurizedReactionChamber");
|
||||
icons[10][0] = register.registerIcon("mekanism:SteelCasing");
|
||||
icons[10][1] = register.registerIcon("mekanism:PressurizedReactionChamber");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -452,6 +455,16 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
return icons[meta][0];
|
||||
}
|
||||
}
|
||||
else if(meta == 10)
|
||||
{
|
||||
if(side == 3)
|
||||
{
|
||||
return icons[meta][1];
|
||||
}
|
||||
else {
|
||||
return icons[meta][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -595,6 +608,16 @@ public class BlockMachine extends BlockContainer implements ISpecialBounds
|
|||
return icons[metadata][0];
|
||||
}
|
||||
}
|
||||
else if(metadata == 10)
|
||||
{
|
||||
if(side == tileEntity.facing)
|
||||
{
|
||||
return icons[metadata][1];
|
||||
}
|
||||
else {
|
||||
return icons[metadata][0];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
|
|
|
@ -450,6 +450,17 @@ public final class OreDictManager
|
|||
RecipeHandler.addCombinerRecipe(MekanismUtils.size(ore, 8), MekanismUtils.size(OreDictionary.getOres("oreSilver").get(0), 1));
|
||||
}
|
||||
} catch(Exception e) {}
|
||||
|
||||
try {
|
||||
for(ItemStack ore : OreDictionary.getOres("treeSapling"))
|
||||
{
|
||||
if(ore.getItemDamage() == 0 || ore.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(ore.getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(Mekanism.BioFuel, 2));
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
153
common/mekanism/common/inventory/container/ContainerPRC.java
Normal file
153
common/mekanism/common/inventory/container/ContainerPRC.java
Normal file
|
@ -0,0 +1,153 @@
|
|||
package mekanism.common.inventory.container;
|
||||
|
||||
import mekanism.common.inventory.slot.SlotEnergy.SlotDischarge;
|
||||
import mekanism.common.inventory.slot.SlotMachineUpgrade;
|
||||
import mekanism.common.inventory.slot.SlotOutput;
|
||||
import mekanism.common.item.ItemMachineUpgrade;
|
||||
import mekanism.common.tile.TileEntityPRC;
|
||||
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 ContainerPRC extends Container
|
||||
{
|
||||
private TileEntityPRC tileEntity;
|
||||
|
||||
public ContainerPRC(InventoryPlayer inventory, TileEntityPRC tentity)
|
||||
{
|
||||
tileEntity = tentity;
|
||||
addSlotToContainer(new Slot(tentity, 0, 56, 17));
|
||||
addSlotToContainer(new SlotDischarge(tentity, 1, 56, 53));
|
||||
addSlotToContainer(new SlotOutput(tentity, 2, 116, 35));
|
||||
addSlotToContainer(new SlotMachineUpgrade(tentity, 3, 180, 11));
|
||||
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(slotID == 2)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(ChargeUtils.canBeDischarged(slotStack))
|
||||
{
|
||||
if(slotID != 1)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 1, 2, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if(slotID == 1)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 4, inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(slotStack.getItem() instanceof ItemMachineUpgrade)
|
||||
{
|
||||
if(slotID != 0 && slotID != 1 && slotID != 2 && slotID != 3)
|
||||
{
|
||||
if(!mergeItemStack(slotStack, 3, 4, false))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if(!mergeItemStack(slotStack, 4, 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;
|
||||
}
|
||||
}
|
|
@ -2,12 +2,14 @@ package mekanism.common.recipe;
|
|||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import mekanism.api.AdvancedInput;
|
||||
import mekanism.api.ChanceOutput;
|
||||
import mekanism.api.ChemicalPair;
|
||||
import mekanism.api.PressurizedProducts;
|
||||
import mekanism.api.PressurizedReactants;
|
||||
import mekanism.api.PressurizedRecipe;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasRegistry;
|
||||
import mekanism.api.gas.GasStack;
|
||||
|
@ -16,6 +18,7 @@ import mekanism.api.infuse.InfusionInput;
|
|||
import mekanism.api.infuse.InfusionOutput;
|
||||
import mekanism.common.util.StackUtils;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
|
@ -172,6 +175,18 @@ public final class RecipeHandler
|
|||
Recipe.CHEMICAL_CRYSTALIZER.put(input, output);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a Pressurized Reaction Chamber recipe
|
||||
* @param input - input PressurizedReactants
|
||||
* @param output - output PressurizedProducts
|
||||
* @param extraEnergy - extra energy needed by the recipe
|
||||
*/
|
||||
public static void addPRCRecipe(PressurizedReactants input, PressurizedProducts output, double extraEnergy, int ticks)
|
||||
{
|
||||
PressurizedRecipe recipe = new PressurizedRecipe(input, extraEnergy, output, ticks);
|
||||
Recipe.PRESSURIZED_REACTION_CHAMBER.put(input, recipe);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the InfusionOutput of the InfusionInput in the parameters.
|
||||
* @param infusion - input Infusion
|
||||
|
@ -242,7 +257,7 @@ public final class RecipeHandler
|
|||
|
||||
/**
|
||||
* Gets the Chemical Crystalizer ItemStack output of the defined GasTank input.
|
||||
* @param itemstack - input GasTank
|
||||
* @param gasTank - input GasTank
|
||||
* @param removeGas - whether or not to use gas in the gas tank
|
||||
* @return output ItemStack
|
||||
*/
|
||||
|
@ -444,6 +459,29 @@ public final class RecipeHandler
|
|||
return null;
|
||||
}
|
||||
|
||||
public static PressurizedRecipe getPRCOutput(ItemStack inputItem, FluidTank inputFluidTank, GasTank inputGasTank)
|
||||
{
|
||||
FluidStack inputFluid = inputFluidTank.getFluid();
|
||||
GasStack inputGas = inputGasTank.getGas();
|
||||
|
||||
if(inputFluid != null && inputGas != null)
|
||||
{
|
||||
HashMap<PressurizedReactants, PressurizedRecipe> recipes = Recipe.PRESSURIZED_REACTION_CHAMBER.get();
|
||||
|
||||
for(PressurizedRecipe recipe : recipes.values())
|
||||
{
|
||||
PressurizedReactants reactants = recipe.reactants;
|
||||
|
||||
if(reactants.meetsInput(inputItem, inputFluid, inputGas))
|
||||
{
|
||||
return recipe.copy();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the output ItemStack of the ItemStack in the parameters.
|
||||
* @param itemstack - input ItemStack
|
||||
|
@ -484,7 +522,7 @@ public final class RecipeHandler
|
|||
CHEMICAL_DISSOLUTION_CHAMBER(new HashMap<ItemStack, FluidStack>()),
|
||||
CHEMICAL_WASHER(new HashMap<GasStack, GasStack>()),
|
||||
CHEMICAL_CRYSTALIZER(new HashMap<GasStack, ItemStack>()),
|
||||
PRESSURIZED_REACTION_CHAMBER(new HashMap<PressurizedReactants, PressurizedProducts>());
|
||||
PRESSURIZED_REACTION_CHAMBER(new HashMap<PressurizedReactants, PressurizedRecipe>());
|
||||
|
||||
private HashMap recipes;
|
||||
|
||||
|
|
|
@ -1,9 +1,25 @@
|
|||
package mekanism.common.tile;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
import mekanism.api.Coord4D;
|
||||
import mekanism.api.EnumColor;
|
||||
import mekanism.api.PressurizedProducts;
|
||||
import mekanism.api.PressurizedRecipe;
|
||||
import mekanism.api.gas.Gas;
|
||||
import mekanism.api.gas.GasStack;
|
||||
import mekanism.api.gas.GasTank;
|
||||
import mekanism.api.gas.GasTransmission;
|
||||
import mekanism.api.gas.IGasHandler;
|
||||
import mekanism.api.gas.ITubeConnection;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.PacketHandler;
|
||||
import mekanism.common.PacketHandler.Transmission;
|
||||
import mekanism.common.SideData;
|
||||
import mekanism.common.block.BlockMachine.MachineType;
|
||||
import mekanism.common.item.ItemMachineUpgrade;
|
||||
import mekanism.common.network.PacketTileEntity;
|
||||
import mekanism.common.recipe.RecipeHandler;
|
||||
import mekanism.common.tile.component.TileComponentEjector;
|
||||
import mekanism.common.tile.component.TileComponentUpgrade;
|
||||
|
@ -12,23 +28,38 @@ import mekanism.common.util.InventoryUtils;
|
|||
import mekanism.common.util.MekanismUtils;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.common.ForgeDirection;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidTank;
|
||||
import net.minecraftforge.fluids.FluidTankInfo;
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
|
||||
public class TileEntityPRC extends TileEntityBasicMachine
|
||||
import dan200.computer.api.IComputerAccess;
|
||||
import dan200.computer.api.ILuaContext;
|
||||
|
||||
public class TileEntityPRC extends TileEntityBasicMachine implements IFluidHandler, IGasHandler, ITubeConnection
|
||||
{
|
||||
FluidTank inputFluidTank = new FluidTank(10000);
|
||||
GasTank inputGasTank = new GasTank(10000);
|
||||
|
||||
GasTank outputGasTank = new GasTank(10000);
|
||||
|
||||
public TileEntityPRC()
|
||||
{
|
||||
super("PressurizedReactionChamber.ogg", "PressurizedReactionChamber", new ResourceLocation("mekanism", "gui/GuiPRC.png"), Mekanism.pressurizedReactionUsage, 200, MachineType.PRESSURIZED_REACTION_CHAMBER.baseEnergy);
|
||||
super("PressurizedReactionChamber.ogg", "PressurizedReactionChamber", new ResourceLocation("mekanism", "gui/GuiPRC.png"), Mekanism.pressurizedReactionBaseUsage, 100, MachineType.PRESSURIZED_REACTION_CHAMBER.baseEnergy);
|
||||
|
||||
sideOutputs.add(new SideData(EnumColor.GREY, InventoryUtils.EMPTY));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_RED, new int[] {0}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_GREEN, new int[] {1}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, new int[] {2, 4}));
|
||||
sideOutputs.add(new SideData(EnumColor.DARK_BLUE, new int[] {2}));
|
||||
sideOutputs.add(new SideData(EnumColor.ORANGE, new int[] {3}));
|
||||
|
||||
sideConfig = new byte[] {2, 1, 0, 0, 4, 3};
|
||||
sideConfig = new byte[] {2, 1, 0, 0, 0, 3};
|
||||
|
||||
inventory = new ItemStack[2];
|
||||
inventory = new ItemStack[4];
|
||||
|
||||
upgradeComponent = new TileComponentUpgrade(this, 3);
|
||||
ejectorComponent = new TileComponentEjector(this, sideOutputs.get(3));
|
||||
|
@ -45,6 +76,8 @@ public class TileEntityPRC extends TileEntityBasicMachine
|
|||
|
||||
if(canOperate() && MekanismUtils.canFunction(this) && getEnergy() >= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_PER_TICK))
|
||||
{
|
||||
PressurizedRecipe recipe = getRecipe();
|
||||
TICKS_REQUIRED = recipe.ticks;
|
||||
setActive(true);
|
||||
|
||||
if((operatingTicks+1) < MekanismUtils.getTicks(getSpeedMultiplier(), TICKS_REQUIRED))
|
||||
|
@ -52,15 +85,16 @@ public class TileEntityPRC extends TileEntityBasicMachine
|
|||
operatingTicks++;
|
||||
electricityStored -= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_PER_TICK);
|
||||
}
|
||||
else if((operatingTicks+1) >= MekanismUtils.getTicks(getSpeedMultiplier(), TICKS_REQUIRED))
|
||||
else if((operatingTicks+1) >= MekanismUtils.getTicks(getSpeedMultiplier(), TICKS_REQUIRED) && electricityStored >= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_PER_TICK + recipe.extraEnergy))
|
||||
{
|
||||
operate();
|
||||
|
||||
operatingTicks = 0;
|
||||
electricityStored -= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_PER_TICK);
|
||||
electricityStored -= MekanismUtils.getEnergyPerTick(getSpeedMultiplier(), getEnergyMultiplier(), ENERGY_PER_TICK + recipe.extraEnergy);
|
||||
}
|
||||
}
|
||||
else {
|
||||
TICKS_REQUIRED = 100;
|
||||
if(prevEnergy >= getEnergy())
|
||||
{
|
||||
setActive(false);
|
||||
|
@ -73,24 +107,36 @@ public class TileEntityPRC extends TileEntityBasicMachine
|
|||
}
|
||||
|
||||
prevEnergy = getEnergy();
|
||||
|
||||
if(outputGasTank.getGas() != null)
|
||||
{
|
||||
GasStack toSend = new GasStack(outputGasTank.getGas().getGas(), Math.min(outputGasTank.getStored(), 16));
|
||||
outputGasTank.draw(GasTransmission.emitGasToNetwork(toSend, this, MekanismUtils.getLeft(facing)), true);
|
||||
|
||||
TileEntity tileEntity = Coord4D.get(this).getFromSide(MekanismUtils.getLeft(facing)).getTileEntity(worldObj);
|
||||
|
||||
if(tileEntity instanceof IGasHandler)
|
||||
{
|
||||
if(((IGasHandler)tileEntity).canReceiveGas(MekanismUtils.getLeft(facing).getOpposite(), outputGasTank.getGas().getGas()))
|
||||
{
|
||||
outputGasTank.draw(((IGasHandler)tileEntity).receiveGas(MekanismUtils.getLeft(facing).getOpposite(), toSend), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int slotID, ItemStack itemstack)
|
||||
{
|
||||
if(slotID == 3)
|
||||
{
|
||||
return itemstack.itemID == Mekanism.SpeedUpgrade.itemID || itemstack.itemID == Mekanism.EnergyUpgrade.itemID;
|
||||
}
|
||||
else if(slotID == 0)
|
||||
{
|
||||
return RecipeHandler.isInRecipe(itemstack, getRecipes());
|
||||
}
|
||||
else if(slotID == 1)
|
||||
if(slotID == 1)
|
||||
{
|
||||
return ChargeUtils.canBeDischarged(itemstack);
|
||||
}
|
||||
else if(slotID == 3)
|
||||
{
|
||||
return itemstack.getItem() instanceof ItemMachineUpgrade;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
@ -98,34 +144,18 @@ public class TileEntityPRC extends TileEntityBasicMachine
|
|||
@Override
|
||||
public void operate()
|
||||
{
|
||||
ChanceOutput output = RecipeHandler.getChanceOutput(inventory[0], true, getRecipes());
|
||||
PressurizedRecipe recipe = getRecipe();
|
||||
|
||||
recipe.reactants.use(inventory[0], inputFluidTank, inputGasTank);
|
||||
|
||||
if(inventory[0].stackSize <= 0)
|
||||
{
|
||||
inventory[0] = null;
|
||||
}
|
||||
|
||||
if(output.hasPrimary())
|
||||
{
|
||||
if(inventory[2] == null)
|
||||
{
|
||||
inventory[2] = output.primaryOutput;
|
||||
}
|
||||
else {
|
||||
inventory[2].stackSize += output.primaryOutput.stackSize;
|
||||
}
|
||||
}
|
||||
recipe.products.fillTank(outputGasTank);
|
||||
|
||||
if(output.hasSecondary() && output.checkSecondary())
|
||||
{
|
||||
if(inventory[4] == null)
|
||||
{
|
||||
inventory[4] = output.secondaryOutput;
|
||||
}
|
||||
else {
|
||||
inventory[4].stackSize += output.secondaryOutput.stackSize;
|
||||
}
|
||||
}
|
||||
recipe.products.addProducts(inventory, 2);
|
||||
|
||||
onInventoryChanged();
|
||||
ejectorComponent.onOutput();
|
||||
|
@ -134,28 +164,25 @@ public class TileEntityPRC extends TileEntityBasicMachine
|
|||
@Override
|
||||
public boolean canOperate()
|
||||
{
|
||||
if(inventory[0] == null)
|
||||
PressurizedRecipe recipe = getRecipe();
|
||||
|
||||
if(recipe == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
ChanceOutput output = RecipeHandler.getChanceOutput(inventory[0], false, getRecipes());
|
||||
PressurizedProducts products = recipe.products;
|
||||
|
||||
if(output == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if(output.hasPrimary())
|
||||
if(products.getOptionalOutput() != null)
|
||||
{
|
||||
if(inventory[2] != null)
|
||||
{
|
||||
if(!inventory[2].isItemEqual(output.primaryOutput))
|
||||
if(!inventory[2].isItemEqual(products.getOptionalOutput()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(inventory[2].stackSize + output.primaryOutput.stackSize > inventory[2].getMaxStackSize())
|
||||
if(inventory[2].stackSize + products.getOptionalOutput().stackSize > inventory[2].getMaxStackSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
@ -163,26 +190,24 @@ public class TileEntityPRC extends TileEntityBasicMachine
|
|||
}
|
||||
}
|
||||
|
||||
if(output.hasSecondary())
|
||||
if(products.getGasOutput() != null)
|
||||
{
|
||||
if(inventory[4] != null)
|
||||
{
|
||||
if(!inventory[4].isItemEqual(output.secondaryOutput))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else {
|
||||
if(inventory[4].stackSize + output.secondaryOutput.stackSize > inventory[4].getMaxStackSize())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
products.getGasOutput().isGasEqual(outputGasTank.getGas());
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public PressurizedRecipe getRecipe()
|
||||
{
|
||||
if(inventory[0] == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return RecipeHandler.getPRCOutput(inventory[0], inputFluidTank, inputGasTank);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int slotID, ItemStack itemstack, int side)
|
||||
{
|
||||
|
@ -215,4 +240,74 @@ public class TileEntityPRC extends TileEntityBasicMachine
|
|||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int fill(ForgeDirection from, FluidStack resource, boolean doFill)
|
||||
{
|
||||
return inputFluidTank.fill(resource, doFill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, FluidStack resource, boolean doDrain)
|
||||
{
|
||||
if(inputFluidTank.getFluid() != null && inputFluidTank.getFluid().isFluidEqual(resource))
|
||||
{
|
||||
return inputFluidTank.drain(resource.amount, doDrain);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ForgeDirection from, int maxDrain, boolean doDrain)
|
||||
{
|
||||
return inputFluidTank.drain(maxDrain, doDrain);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canFill(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return inputFluidTank.getFluid() == null || inputFluidTank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrain(ForgeDirection from, Fluid fluid)
|
||||
{
|
||||
return inputFluidTank.getFluid() != null && inputFluidTank.getFluid().getFluid() == fluid;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTankInfo[] getTankInfo(ForgeDirection from)
|
||||
{
|
||||
return new FluidTankInfo[] {new FluidTankInfo(inputFluidTank)};
|
||||
}
|
||||
|
||||
@Override
|
||||
public int receiveGas(ForgeDirection side, GasStack stack)
|
||||
{
|
||||
return inputGasTank.receive(stack, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public GasStack drawGas(ForgeDirection side, int amount)
|
||||
{
|
||||
return outputGasTank.draw(amount, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canReceiveGas(ForgeDirection side, Gas type)
|
||||
{
|
||||
return inputGasTank.getGas() == null || inputGasTank.getGas().getGas() == type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canDrawGas(ForgeDirection side, Gas type)
|
||||
{
|
||||
return outputGasTank.getGas() != null && outputGasTank.getGas().getGas() == type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canTubeConnect(ForgeDirection side)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,6 @@ public class MekanismGenerators implements IModule
|
|||
public static Version versionNumber = new Version(6, 0, 4);
|
||||
|
||||
//Items
|
||||
public static Item BioFuel;
|
||||
public static Item SolarPanel;
|
||||
|
||||
//Blocks
|
||||
|
@ -95,20 +94,6 @@ public class MekanismGenerators implements IModule
|
|||
Mekanism.logger.info("[MekanismGenerators] Loaded module.");
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit(FMLPostInitializationEvent event)
|
||||
{
|
||||
try {
|
||||
for(ItemStack ore : OreDictionary.getOres("treeSapling"))
|
||||
{
|
||||
if(ore.getItemDamage() == 0 || ore.getItemDamage() == OreDictionary.WILDCARD_VALUE)
|
||||
{
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(ore.getItem(), 1, OreDictionary.WILDCARD_VALUE), new ItemStack(BioFuel, 2));
|
||||
}
|
||||
}
|
||||
} catch(Exception e) {}
|
||||
}
|
||||
|
||||
public void addRecipes()
|
||||
{
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Generator, 1, 0), new Object[] {
|
||||
|
@ -121,7 +106,7 @@ public class MekanismGenerators implements IModule
|
|||
"SES", "SES", "III", Character.valueOf('S'), new ItemStack(Generator, 1, 1), Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('I'), Item.ingotIron
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Generator, 1, 4), new Object[] {
|
||||
"RER", "BCB", "NEN", Character.valueOf('R'), Item.redstone, Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('B'), BioFuel, Character.valueOf('C'), "circuitBasic", Character.valueOf('N'), Item.ingotIron
|
||||
"RER", "BCB", "NEN", Character.valueOf('R'), Item.redstone, Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('B'), Mekanism.BioFuel, Character.valueOf('C'), "circuitBasic", Character.valueOf('N'), Item.ingotIron
|
||||
}));
|
||||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Generator, 1, 3), new Object[] {
|
||||
"PEP", "ICI", "PEP", Character.valueOf('P'), "ingotOsmium", Character.valueOf('E'), Mekanism.EnrichedAlloy, Character.valueOf('I'), new ItemStack(Mekanism.BasicBlock, 1, 8), Character.valueOf('C'), Mekanism.ElectrolyticCore
|
||||
|
@ -132,20 +117,6 @@ public class MekanismGenerators implements IModule
|
|||
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(Generator, 1, 6), new Object[] {
|
||||
" O ", "OAO", "ECE", Character.valueOf('O'), "ingotOsmium", Character.valueOf('A'), Mekanism.EnrichedAlloy, Character.valueOf('E'), Mekanism.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), "circuitBasic"
|
||||
}));
|
||||
|
||||
//BioFuel Crusher Recipes
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Block.tallGrass), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.reed), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.seeds), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.wheat), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.pumpkinSeeds), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.melonSeeds), new ItemStack(BioFuel, 2));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.appleRed), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.bread), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.potato), new ItemStack(BioFuel, 4));
|
||||
RecipeHandler.addCrusherRecipe(new ItemStack(Item.carrot), new ItemStack(BioFuel, 4));
|
||||
|
||||
InfuseRegistry.registerInfuseObject(new ItemStack(BioFuel), new InfuseObject(InfuseRegistry.get("BIO"), 5));
|
||||
}
|
||||
|
||||
public void addBlocks()
|
||||
|
@ -161,15 +132,10 @@ public class MekanismGenerators implements IModule
|
|||
//Declarations
|
||||
Mekanism.configuration.load();
|
||||
SolarPanel = new ItemMekanism(Mekanism.configuration.getItem("SolarPanel", 11300).getInt()).setUnlocalizedName("SolarPanel");
|
||||
BioFuel = new ItemMekanism(Mekanism.configuration.getItem("BioFuel", 11301).getInt()).setUnlocalizedName("BioFuel");
|
||||
Mekanism.configuration.save();
|
||||
|
||||
//Registrations
|
||||
GameRegistry.registerItem(SolarPanel, "SolarPanel");
|
||||
GameRegistry.registerItem(BioFuel, "BioFuel");
|
||||
|
||||
//Ore Dictionary
|
||||
OreDictionary.registerOre("itemBioFuel", new ItemStack(BioFuel));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.EnumSet;
|
|||
|
||||
import mekanism.client.sound.TileSound;
|
||||
import mekanism.common.FluidSlot;
|
||||
import mekanism.common.Mekanism;
|
||||
import mekanism.common.util.ChargeUtils;
|
||||
import mekanism.common.util.MekanismUtils;
|
||||
import mekanism.generators.common.MekanismGenerators;
|
||||
|
@ -179,7 +180,7 @@ public class TileEntityBioGenerator extends TileEntityGenerator implements IFlui
|
|||
|
||||
public int getFuel(ItemStack itemstack)
|
||||
{
|
||||
return itemstack.itemID == MekanismGenerators.BioFuel.itemID ? 200 : 0;
|
||||
return itemstack.itemID == Mekanism.BioFuel.itemID ? 200 : 0;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -32,7 +32,7 @@ public class TileEntityHydrogenGenerator extends TileEntityGenerator implements
|
|||
|
||||
public TileEntityHydrogenGenerator()
|
||||
{
|
||||
super("HydrogenGenerator", 40000, Mekanism.FROM_H2*4);
|
||||
super("HydrogenGenerator", Mekanism.FROM_H2*200, Mekanism.FROM_H2*4);
|
||||
inventory = new ItemStack[2];
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue