Work on fusion fuel creation mechanics, allowed Chemical Washer to accept upgrades

This commit is contained in:
Aidan C. Brady 2015-02-17 21:27:35 -05:00
parent cb2e38ec61
commit 25df777b84
40 changed files with 210 additions and 98 deletions

View file

@ -45,6 +45,13 @@ public class GasStack
{
return type;
}
public GasStack withAmount(int newAmount)
{
amount = newAmount;
return this;
}
/**
* Writes this GasStack to a defined tag compound.

View file

@ -21,7 +21,6 @@ import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.tile.TileEntityChemicalWasher;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraftforge.fluids.FluidTank;
import cpw.mods.fml.relauncher.Side;
@ -40,12 +39,13 @@ public class GuiChemicalWasher extends GuiMekanism
tileEntity = tentity;
guiElements.add(new GuiRedstoneControl(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));
guiElements.add(new GuiUpgradeTab(this, tileEntity, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));
guiElements.add(new GuiBucketIO(this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));
guiElements.add(new GuiEnergyInfo(new IInfoHandler() {
@Override
public List<String> getInfo()
{
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.ENERGY_USAGE);
String multiplier = MekanismUtils.getEnergyDisplay(tileEntity.energyUsage);
return ListUtils.asList("Using: " + multiplier + "/t", "Needed: " + MekanismUtils.getEnergyDisplay(tileEntity.getMaxEnergy()-tileEntity.getEnergy()));
}
}, this, MekanismUtils.getResource(ResourceType.GUI, "GuiChemicalWasher.png")));

View file

@ -8,7 +8,6 @@ import mekanism.common.tile.TileEntityElectricPump;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fluids.FluidTank;
@ -41,7 +40,7 @@ public class GuiElectricPump extends GuiMekanism
}
}, GuiGauge.Type.STANDARD, this, guiLocation, 6, 13));
guiElements.add(new GuiRedstoneControl(this, tileEntity, guiLocation));
guiElements.add(new GuiUpgradeTab(this, tileEntity, guiLocation));
}
@Override

View file

@ -1,6 +1,10 @@
package mekanism.client.nei;
import java.awt.*;
import static codechicken.lib.gui.GuiDraw.changeTexture;
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
import java.awt.Point;
import java.awt.Rectangle;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
@ -22,11 +26,11 @@ import mekanism.client.gui.GuiSlot.SlotOverlay;
import mekanism.client.gui.GuiSlot.SlotType;
import mekanism.common.ObfuscatedNames;
import mekanism.common.recipe.RecipeHandler.Recipe;
import mekanism.common.recipe.inputs.ChemicalPairInput;
import mekanism.common.recipe.inputs.FluidInput;
import mekanism.common.recipe.machines.SeparatorRecipe;
import mekanism.common.util.LangUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraftforge.fluids.FluidStack;
@ -38,9 +42,6 @@ import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.GuiRecipe;
import codechicken.nei.recipe.TemplateRecipeHandler;
import static codechicken.lib.gui.GuiDraw.changeTexture;
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
{
private int ticksPassed;
@ -110,7 +111,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
return "mekanism.electrolyticseparator";
}
public Set<Entry<FluidStack, ChemicalPairInput>> getRecipes()
public Set<Entry<FluidStack, SeparatorRecipe>> getRecipes()
{
return Recipe.ELECTROLYTIC_SEPARATOR.get().entrySet();
}
@ -135,21 +136,21 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
if(recipe.fluidInput != null)
{
fluidInput.setDummyType(recipe.fluidInput.getFluid());
fluidInput.setDummyType(recipe.fluidInput.ingredient.getFluid());
fluidInput.renderScale(0, 0, -xOffset, -yOffset);
}
if(recipe.outputPair.leftGas != null)
if(recipe.outputPair.recipeOutput.leftGas != null)
{
displayGauge(28, 59-xOffset, 19-yOffset, 176, 68, 28, null, recipe.outputPair.leftGas);
leftGas.setDummyType(recipe.outputPair.leftGas.getGas());
displayGauge(28, 59-xOffset, 19-yOffset, 176, 68, 28, null, recipe.outputPair.recipeOutput.leftGas);
leftGas.setDummyType(recipe.outputPair.recipeOutput.leftGas.getGas());
leftGas.renderScale(0, 0, -xOffset, -yOffset);
}
if(recipe.outputPair.rightGas != null)
if(recipe.outputPair.recipeOutput.rightGas != null)
{
displayGauge(28, 101-xOffset, 19-yOffset, 176, 68, 28, null, recipe.outputPair.rightGas);
rightGas.setDummyType(recipe.outputPair.rightGas.getGas());
displayGauge(28, 101-xOffset, 19-yOffset, 176, 68, 28, null, recipe.outputPair.recipeOutput.rightGas);
rightGas.setDummyType(recipe.outputPair.recipeOutput.rightGas.getGas());
rightGas.renderScale(0, 0, -xOffset, -yOffset);
}
}
@ -180,9 +181,9 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
}
else if(outputId.equals("gas") && results.length == 1 && results[0] instanceof GasStack)
{
for(Map.Entry<FluidStack, ChemicalPairInput> irecipe : getRecipes())
for(Map.Entry<FluidStack, SeparatorRecipe> irecipe : getRecipes())
{
if(irecipe.getValue().containsType((GasStack)results[0]))
if(irecipe.getValue().recipeOutput.containsType((GasStack)results[0]))
{
arecipes.add(new CachedIORecipe(irecipe));
}
@ -198,7 +199,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
{
if(inputId.equals("fluid") && ingredients.length == 1 && ingredients[0] instanceof FluidStack)
{
for(Map.Entry<FluidStack, ChemicalPairInput> irecipe : getRecipes())
for(Map.Entry<FluidStack, SeparatorRecipe> irecipe : getRecipes())
{
if(irecipe.getKey().isFluidEqual((FluidStack)ingredients[0]))
{
@ -221,15 +222,15 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7)
{
currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidInput));
currenttip.add(LangUtils.localizeFluidStack(((CachedIORecipe)arecipes.get(recipe)).fluidInput.ingredient));
}
else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7)
{
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas.getGas().getLocalizedName());
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.recipeOutput.leftGas.getGas().getLocalizedName());
}
else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7)
{
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas.getGas().getLocalizedName());
currenttip.add(((CachedIORecipe)arecipes.get(recipe)).outputPair.recipeOutput.rightGas.getGas().getLocalizedName());
}
return super.handleTooltip(gui, currenttip, recipe);
@ -248,15 +249,15 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7)
{
fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidInput;
fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidInput.ingredient;
}
else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7)
{
gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas;
gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.recipeOutput.leftGas;
}
else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7)
{
gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas;
gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.recipeOutput.rightGas;
}
if(gas != null)
@ -310,15 +311,15 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
if(xAxis >= 6 && xAxis <= 22 && yAxis >= 11+7 && yAxis <= 69+7)
{
fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidInput;
fluid = ((CachedIORecipe)arecipes.get(recipe)).fluidInput.ingredient;
}
else if(xAxis >= 59 && xAxis <= 75 && yAxis >= 19+7 && yAxis <= 47+7)
{
gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.leftGas;
gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.recipeOutput.leftGas;
}
else if(xAxis >= 101 && xAxis <= 117 && yAxis >= 19+7 && yAxis <= 47+7)
{
gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.rightGas;
gas = ((CachedIORecipe)arecipes.get(recipe)).outputPair.recipeOutput.rightGas;
}
if(gas != null)
@ -367,8 +368,8 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
public class CachedIORecipe extends TemplateRecipeHandler.CachedRecipe
{
public FluidStack fluidInput;
public ChemicalPairInput outputPair;
public FluidInput fluidInput;
public SeparatorRecipe outputPair;
@Override
public PositionedStack getResult()
@ -376,7 +377,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
return null;
}
public CachedIORecipe(FluidStack input, ChemicalPairInput pair)
public CachedIORecipe(FluidInput input, SeparatorRecipe pair)
{
fluidInput = input;
outputPair = pair;
@ -384,7 +385,7 @@ public class ElectrolyticSeparatorRecipeHandler extends BaseRecipeHandler
public CachedIORecipe(Map.Entry recipe)
{
this((FluidStack)recipe.getKey(), (ChemicalPairInput)recipe.getValue());
this((FluidInput)recipe.getKey(), (SeparatorRecipe)recipe.getValue());
}
}
}

View file

@ -110,11 +110,13 @@ public class MekanismRenderer
}
FluidRegistry.getFluid("brine").setIcons(event.map.registerIcon("mekanism:LiquidBrine"));
FluidRegistry.getFluid("heavywater").setIcons(event.map.registerIcon("mekanism:LiquidHeavyWater"));
if(RenderPartTransmitter.getInstance() != null)
{
RenderPartTransmitter.getInstance().resetDisplayInts();
}
RenderDynamicTank.resetDisplayInts();
RenderSalinationController.resetDisplayInts();
RenderPortableTank.resetDisplayInts();

View file

@ -136,6 +136,7 @@ public class HeatNetwork extends DynamicNetwork<IHeatTransfer, HeatNetwork>
newHeatLost += d[1];
}
}
for(IGridTransmitter<HeatNetwork> transmitter : transmitters)
{
if(transmitter instanceof IHeatTransfer)
@ -145,6 +146,7 @@ public class HeatNetwork extends DynamicNetwork<IHeatTransfer, HeatNetwork>
}
}
}
heatLost = newHeatLost;
heatTransferred = newHeatTransferred;
meanTemp = newSumTemp / transmitters.size();

View file

@ -32,7 +32,6 @@ import mekanism.common.Tier.EnergyCubeTier;
import mekanism.common.Tier.FactoryTier;
import mekanism.common.base.IFactory.RecipeType;
import mekanism.common.base.IModule;
import mekanism.common.content.boiler.BoilerCache;
import mekanism.common.content.boiler.BoilerManager;
import mekanism.common.content.boiler.SynchronizedBoilerData;
import mekanism.common.content.matrix.MatrixCache;
@ -75,7 +74,6 @@ import mekanism.common.util.MekanismUtils;
import mekanism.common.util.MekanismUtils.ResourceType;
import mekanism.common.voice.VoiceServerManager;
import mekanism.common.world.GenHandler;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
@ -91,12 +89,20 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.config.Configuration;
import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.RecipeSorter;
import net.minecraftforge.oredict.RecipeSorter.Category;
import net.minecraftforge.oredict.ShapelessOreRecipe;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import rebelkeithy.mods.metallurgy.api.IOreInfo;
import rebelkeithy.mods.metallurgy.api.MetallurgyAPI;
import codechicken.multipart.handler.MultipartProxy;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.IFuelHandler;
@ -114,12 +120,6 @@ import cpw.mods.fml.common.network.NetworkRegistry;
import cpw.mods.fml.common.registry.EntityRegistry;
import cpw.mods.fml.common.registry.GameRegistry;
import codechicken.multipart.handler.MultipartProxy;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import rebelkeithy.mods.metallurgy.api.IOreInfo;
import rebelkeithy.mods.metallurgy.api.MetallurgyAPI;
/**
* Mekanism - a Minecraft mod
* @author AidanBrady
@ -286,6 +286,9 @@ public class Mekanism
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.EnergyUpgrade), new Object[] {
" G ", "ADA", " G ", Character.valueOf('G'), "blockGlass", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('D'), "dustGold"
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(new ItemStack(MekanismItems.FilterUpgrade), new Object[] {
" G ", "ADA", " G ", Character.valueOf('G'), "blockGlass", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('D'), "dustTin"
}));
CraftingManager.getInstance().getRecipeList().add(new MekanismRecipe(MekanismItems.AtomicDisassembler.getUnchargedItem(), new Object[] {
"AEA", "ACA", " O ", Character.valueOf('A'), MekanismItems.EnrichedAlloy, Character.valueOf('E'), MekanismItems.EnergyTablet.getUnchargedItem(), Character.valueOf('C'), MekanismItems.AtomicAlloy, Character.valueOf('O'), "ingotRefinedObsidian"
}));
@ -1038,6 +1041,8 @@ public class Mekanism
GasRegistry.register(new Gas("fusionFuelDT")).registerFluid();
GasRegistry.register(new Gas("steam")).registerFluid();
FluidRegistry.registerFluid(new Fluid("heavyWater"));
for(Resource resource : Resource.values())
{
String name = resource.getName();

View file

@ -50,6 +50,7 @@ public class MekanismItems
public static final ItemEnergized EnergyTablet = (ItemEnergized)new ItemEnergized(1000000).setUnlocalizedName("EnergyTablet");
public static final Item SpeedUpgrade = new ItemUpgrade(Upgrade.SPEED).setUnlocalizedName("SpeedUpgrade");
public static final Item EnergyUpgrade = new ItemUpgrade(Upgrade.ENERGY).setUnlocalizedName("EnergyUpgrade");
public static final Item FilterUpgrade = new ItemUpgrade(Upgrade.FILTER).setUnlocalizedName("FilterUpgrade");
public static final ItemRobit Robit = (ItemRobit)new ItemRobit().setUnlocalizedName("Robit");
public static final ItemAtomicDisassembler AtomicDisassembler = (ItemAtomicDisassembler)new ItemAtomicDisassembler().setUnlocalizedName("AtomicDisassembler");
public static final Item EnrichedIron = new ItemMekanism().setUnlocalizedName("EnrichedIron");
@ -104,6 +105,7 @@ public class MekanismItems
GameRegistry.registerItem(EnergyTablet, "EnergyTablet");
GameRegistry.registerItem(SpeedUpgrade, "SpeedUpgrade");
GameRegistry.registerItem(EnergyUpgrade, "EnergyUpgrade");
GameRegistry.registerItem(FilterUpgrade, "HeavyWaterUpgrade");
GameRegistry.registerItem(Robit, "Robit");
GameRegistry.registerItem(AtomicDisassembler, "AtomicDisassembler");
GameRegistry.registerItem(EnrichedAlloy, "EnrichedAlloy");

View file

@ -19,7 +19,8 @@ import net.minecraftforge.common.util.Constants.NBT;
public enum Upgrade
{
SPEED("speed", 8, EnumColor.RED),
ENERGY("energy", 8, EnumColor.BRIGHT_GREEN);
ENERGY("energy", 8, EnumColor.BRIGHT_GREEN),
FILTER("filter", 1, EnumColor.DARK_AQUA);
private String name;
private int maxStack;
@ -66,6 +67,8 @@ public enum Upgrade
return new ItemStack(MekanismItems.SpeedUpgrade);
case ENERGY:
return new ItemStack(MekanismItems.EnergyUpgrade);
case FILTER:
return new ItemStack(MekanismItems.FilterUpgrade);
}
return null;

View file

@ -521,7 +521,7 @@ public class ItemBlockMachine extends ItemBlock implements IEnergizedItem, ISpec
return itemstack;
}
FluidStack fluid = MekanismUtils.getFluid(world, coord.xCoord, coord.yCoord, coord.zCoord);
FluidStack fluid = MekanismUtils.getFluid(world, coord.xCoord, coord.yCoord, coord.zCoord, false);
if(fluid != null && (getFluidStack(itemstack) == null || getFluidStack(itemstack).isFluidEqual(fluid)))
{

View file

@ -24,13 +24,14 @@ public class FluidInput extends MachineInput<FluidInput>
return ingredient != null;
}
public boolean useFluid(FluidTank fluidTank, boolean deplete)
public boolean useFluid(FluidTank fluidTank, boolean deplete, int scale)
{
if(fluidTank.getFluid().containsFluid(ingredient))
{
fluidTank.drain(ingredient.amount, deplete);
fluidTank.drain(ingredient.amount*scale, deplete);
return true;
}
return false;
}

View file

@ -24,13 +24,15 @@ public class GasInput extends MachineInput<GasInput>
return ingredient != null;
}
public boolean useGas(GasTank gasTank, boolean deplete)
public boolean useGas(GasTank gasTank, boolean deplete, int scale)
{
if(gasTank.getGasType() == ingredient.getGas() && gasTank.getStored() >= ingredient.amount)
if(gasTank.getGasType() == ingredient.getGas() && gasTank.getStored() >= ingredient.amount*scale)
{
gasTank.draw(ingredient.amount, deplete);
gasTank.draw(ingredient.amount*scale, deplete);
return true;
}
return false;
}
@ -47,6 +49,7 @@ public class GasInput extends MachineInput<GasInput>
{
return !other.isValid();
}
return other.ingredient.hashCode() == ingredient.hashCode();
}

View file

@ -24,14 +24,14 @@ public class ChemicalInfuserRecipe extends MachineRecipe<ChemicalPairInput, GasO
public boolean canOperate(GasTank leftTank, GasTank rightTank, GasTank outputTank)
{
return getInput().useGas(leftTank, rightTank, false) && getOutput().applyOutputs(outputTank, false);
return getInput().useGas(leftTank, rightTank, false) && getOutput().applyOutputs(outputTank, false, 1);
}
public void operate(GasTank leftInput, GasTank rightInput, GasTank outputTank)
{
if(getInput().useGas(leftInput, rightInput, true))
{
getOutput().applyOutputs(outputTank, true);
getOutput().applyOutputs(outputTank, true, 1);
}
}
}

View file

@ -21,12 +21,12 @@ public class CrystallizerRecipe extends MachineRecipe<GasInput, ItemStackOutput,
public boolean canOperate(GasTank gasTank, ItemStack[] inventory)
{
return getInput().useGas(gasTank, false) && getOutput().applyOutputs(inventory, 1, false);
return getInput().useGas(gasTank, false, 1) && getOutput().applyOutputs(inventory, 1, false);
}
public void operate(GasTank inputTank, ItemStack[] inventory)
{
if(getInput().useGas(inputTank, true))
if(getInput().useGas(inputTank, true, 1))
{
getOutput().applyOutputs(inventory, 1, true);
}

View file

@ -21,14 +21,14 @@ public class DissolutionRecipe extends MachineRecipe<ItemStackInput, GasOutput,
public boolean canOperate(ItemStack[] inventory, GasTank outputTank)
{
return getInput().useItemStackFromInventory(inventory, 1, false) && getOutput().applyOutputs(outputTank, false);
return getInput().useItemStackFromInventory(inventory, 1, false) && getOutput().applyOutputs(outputTank, false, 1);
}
public void operate(ItemStack[] inventory, GasTank outputTank)
{
if(getInput().useItemStackFromInventory(inventory, 1, true))
{
getOutput().applyOutputs(outputTank, true);
getOutput().applyOutputs(outputTank, true, 1);
}
}

View file

@ -25,14 +25,14 @@ public class GasCentrifugeRecipe extends MachineRecipe<GasInput, GasOutput, GasC
public boolean canOperate(GasTank inputTank, GasTank outputTank)
{
return getInput().useGas(inputTank, false) && getOutput().applyOutputs(outputTank, false);
return getInput().useGas(inputTank, false, 1) && getOutput().applyOutputs(outputTank, false, 1);
}
public void operate(GasTank inputTank, GasTank outputTank)
{
if(getInput().useGas(inputTank, true))
if(getInput().useGas(inputTank, true, 1))
{
getOutput().applyOutputs(outputTank, true);
getOutput().applyOutputs(outputTank, true, 1);
}
}

View file

@ -27,14 +27,14 @@ public class OxidationRecipe extends MachineRecipe<ItemStackInput, GasOutput, Ox
public boolean canOperate(ItemStack[] inventory, GasTank outputTank)
{
return getInput().useItemStackFromInventory(inventory, 0, false) && getOutput().applyOutputs(outputTank, false);
return getInput().useItemStackFromInventory(inventory, 0, false) && getOutput().applyOutputs(outputTank, false, 1);
}
public void operate(ItemStack[] inventory, GasTank outputTank)
{
if(getInput().useItemStackFromInventory(inventory, 0, true))
{
getOutput().applyOutputs(outputTank, true);
getOutput().applyOutputs(outputTank, true, 1);
}
}
}

View file

@ -31,12 +31,12 @@ public class SeparatorRecipe extends MachineRecipe<FluidInput, ChemicalPairOutpu
public boolean canOperate(FluidTank fluidTank, GasTank leftTank, GasTank rightTank)
{
return getInput().useFluid(fluidTank, false) && getOutput().applyOutputs(leftTank, rightTank, false);
return getInput().useFluid(fluidTank, false, 1) && getOutput().applyOutputs(leftTank, rightTank, false);
}
public void operate(FluidTank fluidTank, GasTank leftTank, GasTank rightTank)
{
if(getInput().useFluid(fluidTank, true))
if(getInput().useFluid(fluidTank, true, 1))
{
getOutput().applyOutputs(leftTank, rightTank, true);
}

View file

@ -33,14 +33,14 @@ public class WasherRecipe extends MachineRecipe<GasInput, GasOutput, WasherRecip
public boolean canOperate(GasTank inputTank, FluidTank fluidTank, GasTank outputTank)
{
return getInput().useGas(inputTank, false) && waterInput.useFluid(fluidTank, false) && getOutput().applyOutputs(outputTank, false);
return getInput().useGas(inputTank, false, 1) && waterInput.useFluid(fluidTank, false, 1) && getOutput().applyOutputs(outputTank, false, 1);
}
public void operate(GasTank inputTank, FluidTank fluidTank, GasTank outputTank)
public void operate(GasTank inputTank, FluidTank fluidTank, GasTank outputTank, int scale)
{
if(getInput().useGas(inputTank, true) && waterInput.useFluid(fluidTank, true))
if(getInput().useGas(inputTank, true, scale) && waterInput.useFluid(fluidTank, true, scale))
{
getOutput().applyOutputs(outputTank, true);
getOutput().applyOutputs(outputTank, true, scale);
}
}
}

View file

@ -18,13 +18,15 @@ public class GasOutput extends MachineOutput<GasOutput>
return new GasOutput(output.copy());
}
public boolean applyOutputs(GasTank gasTank, boolean doEmit)
public boolean applyOutputs(GasTank gasTank, boolean doEmit, int scale)
{
if(gasTank.canReceive(output.getGas()) && gasTank.getNeeded() >= output.amount)
if(gasTank.canReceive(output.getGas()) && gasTank.getNeeded() >= output.amount*scale)
{
gasTank.receive(output.copy(), doEmit);
gasTank.receive(output.copy().withAmount(output.amount*scale), doEmit);
return true;
}
return false;
}
}

View file

@ -43,9 +43,9 @@ public class TileEntityAmbientAccumulator extends TileEntityContainerBlock imple
cachedRecipe = RecipeHandler.getDimensionGas(new IntegerInput(cachedDimensionId));
}
if(cachedRecipe != null && gasRand.nextDouble() < 0.05 && cachedRecipe.getOutput().applyOutputs(collectedGas, false))
if(cachedRecipe != null && gasRand.nextDouble() < 0.05 && cachedRecipe.getOutput().applyOutputs(collectedGas, false, 1))
{
cachedRecipe.getOutput().applyOutputs(collectedGas, true);
cachedRecipe.getOutput().applyOutputs(collectedGas, true, 1);
}
}
}

View file

@ -238,6 +238,7 @@ public abstract class TileEntityBasicMachine<INPUT extends MachineInput<INPUT>,
ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED);
case ENERGY: //and SPEED fall-through.
energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK);
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
}
}

View file

@ -502,6 +502,7 @@ public class TileEntityChemicalCrystallizer extends TileEntityNoisyElectricBlock
ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED);
case ENERGY:
energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE);
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
}
}
}

View file

@ -214,16 +214,18 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
public double getScaledProgress()
{
return ((double)operatingTicks) / ((double)BASE_TICKS_REQUIRED);
return ((double)operatingTicks) / ((double)ticksRequired);
}
public DissolutionRecipe getRecipe()
{
ItemStackInput input = getInput();
if(cachedRecipe == null || !input.testEquality(cachedRecipe.getInput()))
{
cachedRecipe = RecipeHandler.getDissolutionRecipe(getInput());
}
return cachedRecipe;
}
@ -464,6 +466,7 @@ public class TileEntityChemicalDissolutionChamber extends TileEntityNoisyElectri
ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED);
case ENERGY:
energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE);
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
}
}
}

View file

@ -201,10 +201,12 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
public OxidationRecipe getRecipe()
{
ItemStackInput input = getInput();
if(cachedRecipe == null || !input.testEquality(cachedRecipe.getInput()))
{
cachedRecipe = RecipeHandler.getOxidizerRecipe(getInput());
}
return cachedRecipe;
}
@ -384,6 +386,7 @@ public class TileEntityChemicalOxidizer extends TileEntityNoisyElectricBlock imp
ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED);
case ENERGY:
energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE);
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
}
}
}

View file

@ -1,5 +1,7 @@
package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import mekanism.api.Coord4D;
@ -14,19 +16,21 @@ import mekanism.api.gas.IGasHandler;
import mekanism.api.gas.IGasItem;
import mekanism.api.gas.ITubeConnection;
import mekanism.common.Mekanism;
import mekanism.common.Upgrade;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.ISustainedData;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.block.BlockMachine.MachineType;
import mekanism.common.network.PacketTileEntity.TileEntityMessage;
import mekanism.common.recipe.RecipeHandler;
import mekanism.common.recipe.inputs.GasInput;
import mekanism.common.recipe.machines.WasherRecipe;
import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.FluidContainerUtils;
import mekanism.common.util.InventoryUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
@ -42,9 +46,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
import io.netty.buffer.ByteBuf;
public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandler, ISustainedData
public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock implements IGasHandler, ITubeConnection, IRedstoneControl, IFluidHandler, IUpgradeTile, ISustainedData
{
public FluidTank fluidTank = new FluidTank(MAX_FLUID);
public GasTank inputTank = new GasTank(MAX_GAS);
@ -65,9 +67,13 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
public double prevEnergy;
public final double ENERGY_USAGE = usage.chemicalWasherUsage;
public final double BASE_ENERGY_USAGE = usage.chemicalWasherUsage;
public double energyUsage = usage.chemicalWasherUsage;
public WasherRecipe cachedRecipe;
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 4);
/** This machine's current RedstoneControl type. */
public RedstoneControl controlType = RedstoneControl.DISABLED;
@ -75,7 +81,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
public TileEntityChemicalWasher()
{
super("washer", "ChemicalWasher", MachineType.CHEMICAL_WASHER.baseEnergy);
inventory = new ItemStack[4];
inventory = new ItemStack[5];
}
@Override
@ -114,13 +120,13 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
outputTank.draw(GasTransmission.addGas(inventory[2], outputTank.getGas()), true);
}
if(canOperate(recipe) && getEnergy() >= ENERGY_USAGE && MekanismUtils.canFunction(this))
if(canOperate(recipe) && getEnergy() >= energyUsage && MekanismUtils.canFunction(this))
{
setActive(true);
operate(recipe);
setEnergy(getEnergy() - ENERGY_USAGE);
setEnergy(getEnergy() - energyUsage);
}
else {
if(prevEnergy >= getEnergy())
@ -151,10 +157,12 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
public WasherRecipe getRecipe()
{
GasInput input = getInput();
if(cachedRecipe == null || !input.testEquality(cachedRecipe.getInput()))
{
cachedRecipe = RecipeHandler.getChemicalWasherRecipe(getInput());
}
return cachedRecipe;
}
@ -170,7 +178,7 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
public void operate(WasherRecipe recipe)
{
recipe.operate(inputTank, fluidTank, outputTank);
recipe.operate(inputTank, fluidTank, outputTank, getUpgradedUsage());
}
private void manageBuckets()
@ -244,7 +252,15 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
}
}
}
public int getUpgradedUsage()
{
int possibleProcess = Math.min(inputTank.getStored(), outputTank.getNeeded());
possibleProcess = Math.min((int)Math.pow(2, upgradeComponent.getUpgrades(Upgrade.SPEED)), possibleProcess);
return Math.min(fluidTank.getFluidAmount()/WATER_USAGE, possibleProcess);
}
@Override
public void handlePacketData(ByteBuf dataStream)
{
@ -612,4 +628,23 @@ public class TileEntityChemicalWasher extends TileEntityNoisyElectricBlock imple
inputTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("inputTank")));
outputTank.setGas(GasStack.readFromNBT(itemStack.stackTagCompound.getCompoundTag("outputTank")));
}
@Override
public TileComponentUpgrade getComponent()
{
return upgradeComponent;
}
@Override
public void recalculateUpgradables(Upgrade upgrade)
{
super.recalculateUpgradables(upgrade);
switch(upgrade)
{
case ENERGY:
energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE);
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
}
}
}

View file

@ -1478,6 +1478,7 @@ public class TileEntityDigitalMiner extends TileEntityElectricBlock implements I
delayLength = MekanismUtils.getTicks(this, 80);
case ENERGY:
energyUsage = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_USAGE);
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
}
}
}

View file

@ -1,5 +1,7 @@
package mekanism.common.tile;
import io.netty.buffer.ByteBuf;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
@ -12,13 +14,15 @@ import mekanism.api.Coord4D;
import mekanism.api.EnumColor;
import mekanism.api.IConfigurable;
import mekanism.api.MekanismConfig.usage;
import mekanism.common.Upgrade;
import mekanism.common.base.IRedstoneControl;
import mekanism.common.base.ISustainedTank;
import mekanism.common.base.IUpgradeTile;
import mekanism.common.tile.component.TileComponentUpgrade;
import mekanism.common.util.ChargeUtils;
import mekanism.common.util.FluidContainerUtils;
import mekanism.common.util.MekanismUtils;
import mekanism.common.util.PipeUtils;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -35,9 +39,7 @@ import net.minecraftforge.fluids.FluidTankInfo;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
import io.netty.buffer.ByteBuf;
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable, IRedstoneControl
public class TileEntityElectricPump extends TileEntityElectricBlock implements IFluidHandler, ISustainedTank, IConfigurable, IRedstoneControl, IUpgradeTile
{
/** This pump's tank */
public FluidTank fluidTank = new FluidTank(10000);
@ -47,11 +49,16 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
/** This machine's current RedstoneControl type. */
public RedstoneControl controlType = RedstoneControl.DISABLED;
public TileComponentUpgrade upgradeComponent = new TileComponentUpgrade(this, 3);
public TileEntityElectricPump()
{
super("ElectricPump", 10000);
inventory = new ItemStack[3];
inventory = new ItemStack[4];
upgradeComponent.clearSupportedTypes();
upgradeComponent.setSupported(Upgrade.FILTER);
}
@Override
@ -131,8 +138,7 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
suck(true);
}
}
else
{
else {
ticker--;
}
}
@ -158,6 +164,11 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
}
}
}
public boolean hasFilter()
{
return upgradeComponent.getInstalledTypes().contains(Upgrade.FILTER);
}
public boolean suck(boolean take)
{
@ -171,13 +182,13 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
if(MekanismUtils.isFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord))
{
if(fluidTank.getFluid() == null || MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord).isFluidEqual(fluidTank.getFluid()))
if(fluidTank.getFluid() == null || MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord, hasFilter()).isFluidEqual(fluidTank.getFluid()))
{
if(take)
{
setEnergy(getEnergy() - usage.electricPumpUsage);
recurringNodes.add(wrapper.clone());
fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord), true);
fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord, hasFilter()), true);
worldObj.setBlockToAir(wrapper.xCoord, wrapper.yCoord, wrapper.zCoord);
}
@ -192,12 +203,12 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
if(MekanismUtils.isFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord))
{
if(fluidTank.getFluid() == null || MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord).isFluidEqual(fluidTank.getFluid()))
if(fluidTank.getFluid() == null || MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord, hasFilter()).isFluidEqual(fluidTank.getFluid()))
{
if(take)
{
setEnergy(getEnergy() - usage.electricPumpUsage);
fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord), true);
fluidTank.fill(MekanismUtils.getFluid(worldObj, wrapper.xCoord, wrapper.yCoord, wrapper.zCoord, hasFilter()), true);
worldObj.setBlockToAir(wrapper.xCoord, wrapper.yCoord, wrapper.zCoord);
}
@ -214,13 +225,13 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
if(MekanismUtils.isFluid(worldObj, side.xCoord, side.yCoord, side.zCoord))
{
if(fluidTank.getFluid() == null || MekanismUtils.getFluid(worldObj, side.xCoord, side.yCoord, side.zCoord).isFluidEqual(fluidTank.getFluid()))
if(fluidTank.getFluid() == null || MekanismUtils.getFluid(worldObj, side.xCoord, side.yCoord, side.zCoord, hasFilter()).isFluidEqual(fluidTank.getFluid()))
{
if(take)
{
setEnergy(getEnergy() - usage.electricPumpUsage);
recurringNodes.add(side);
fluidTank.fill(MekanismUtils.getFluid(worldObj, side.xCoord, side.yCoord, side.zCoord), true);
fluidTank.fill(MekanismUtils.getFluid(worldObj, side.xCoord, side.yCoord, side.zCoord, hasFilter()), true);
worldObj.setBlockToAir(side.xCoord, side.yCoord, side.zCoord);
}
@ -495,4 +506,10 @@ public class TileEntityElectricPump extends TileEntityElectricBlock implements I
{
return true;
}
@Override
public TileComponentUpgrade getComponent()
{
return upgradeComponent;
}
}

View file

@ -944,6 +944,7 @@ public class TileEntityFactory extends TileEntityNoisyElectricBlock implements I
secondaryEnergyPerTick = MekanismUtils.getSecondaryEnergyPerTickMean(this, recipeType.getSecondaryEnergyPerTick());
case ENERGY:
energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK);
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
}
}
}

View file

@ -241,6 +241,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
for(Object obj : Recipe.METALLURGIC_INFUSER.get().keySet())
{
InfusionInput input = (InfusionInput)obj;
if(input.inputStack.isItemEqual(itemstack))
{
return true;
@ -543,6 +544,7 @@ public class TileEntityMetallurgicInfuser extends TileEntityNoisyElectricBlock i
ticksRequired = MekanismUtils.getTicks(this, BASE_TICKS_REQUIRED);
case ENERGY:
energyPerTick = MekanismUtils.getEnergyPerTick(this, BASE_ENERGY_PER_TICK);
maxEnergy = MekanismUtils.getMaxEnergy(this, BASE_MAX_ENERGY);
}
}
}

View file

@ -142,6 +142,11 @@ public class TileComponentUpgrade implements ITileComponent
{
return supported;
}
public void clearSupportedTypes()
{
supported.clear();
}
@Override
public void read(ByteBuf dataStream)
@ -181,6 +186,7 @@ public class TileComponentUpgrade implements ITileComponent
public void read(NBTTagCompound nbtTags)
{
upgrades = Upgrade.buildMap(nbtTags);
for(Upgrade upgrade : getSupportedTypes())
{
tileEntity.recalculateUpgradables(upgrade);

View file

@ -745,7 +745,7 @@ public final class MekanismUtils
*/
public static boolean isFluid(World world, int x, int y, int z)
{
return getFluid(world, x, y, z) != null;
return getFluid(world, x, y, z, false) != null;
}
/**
@ -756,7 +756,7 @@ public final class MekanismUtils
* @param z - z coordinate
* @return the fluid at the certain location, null if it doesn't exist
*/
public static FluidStack getFluid(World world, int x, int y, int z)
public static FluidStack getFluid(World world, int x, int y, int z, boolean filter)
{
Block block = world.getBlock(x, y, z);
int meta = world.getBlockMetadata(x, y, z);
@ -768,7 +768,13 @@ public final class MekanismUtils
if((block == Blocks.water || block == Blocks.flowing_water) && meta == 0)
{
return new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME);
if(!filter)
{
return new FluidStack(FluidRegistry.WATER, FluidContainerRegistry.BUCKET_VOLUME);
}
else {
return new FluidStack(FluidRegistry.getFluid("heavywater"), 10);
}
}
else if((block == Blocks.lava || block == Blocks.flowing_lava) && meta == 0)
{

View file

@ -10,6 +10,7 @@ item.AtomicAlloy.name=Atomic Alloy
item.EnergyTablet.name=Energy Tablet
item.SpeedUpgrade.name=Speed Upgrade
item.EnergyUpgrade.name=Energy Upgrade
item.FilterUpgrade.name=Filter Upgrade
item.Robit.name=Robit
item.AtomicDisassembler.name=Atomic Disassembler
item.ElectricBow.name=Electric Bow
@ -275,6 +276,7 @@ fluid.hydrogenChloride=Liquid Hydrogen Chloride
fluid.brine=Brine
fluid.ethene=Liquid Ethylene
fluid.sodium=Liquid Sodium
fluid.heavyWater=Heavy Water
//OreGas names
oregas.iron=Iron Ore
@ -299,6 +301,8 @@ upgrade.energy=Energy
upgrade.energy.desc=Increases energy efficiency !nand capacity of machinery.
upgrade.speed=Speed
upgrade.speed.desc=Increases speed of machinery.
upgrade.filter=Filter
upgrade.filter.desc=A filter that separates !nheavy water from regular water.
//Key description text
key.mode=Mode Switch

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.5 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.2 KiB

After

Width:  |  Height:  |  Size: 6.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 13 KiB

View file

@ -0,0 +1,5 @@
{
"animation": {
"frametime": 2
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB