diff --git a/changelog b/changelog index fa755b7ee..4d6932f67 100644 --- a/changelog +++ b/changelog @@ -7,6 +7,10 @@ * Old files are still compatible if moved to the new folder, since the base structure of the recipe file is the same * Recipes should work as expected with the `/ntmreload` command * Recipes now have an optional list for specifying which template folder they are made in +* Electrolyzing heavy water now has the same yields as regular water, I don't remember why this incsonsistency existed and there was probably a reason for it but I don't care +* Electrolyzing fluids now only takes 20 ticks instead of 60 + * Batch sizes for water and heavy water have been doubled, effectively increasing throughout 6x + * The throughput for electrolysis on chemical plants has been halved (but heavy water still has the output buff, effectively remaining unchanged) ## Fixed * Fixed the structure toggle on the world creation screen not working correctly on most world types diff --git a/src/main/java/com/hbm/config/CustomMachineConfigJSON.java b/src/main/java/com/hbm/config/CustomMachineConfigJSON.java index adbd60981..dc746f7d8 100644 --- a/src/main/java/com/hbm/config/CustomMachineConfigJSON.java +++ b/src/main/java/com/hbm/config/CustomMachineConfigJSON.java @@ -159,52 +159,49 @@ public class CustomMachineConfigJSON { configuration.fluidOutCap = machineObject.get("fluidOutCap").getAsInt(); configuration.itemOutCount = machineObject.get("itemOutCount").getAsInt(); configuration.generatorMode = machineObject.get("generatorMode").getAsBoolean(); - if(machineObject.get("maxPollutionCap")!=null) { - configuration.maxPollutionCap = machineObject.get("maxPollutionCap").getAsInt(); - } - else configuration.maxPollutionCap = 0; - if(machineObject.get("fluxMode")!=null) { - configuration.fluxMode = machineObject.get("fluxMode").getAsBoolean(); - } - else configuration.fluxMode = false; + if(machineObject.has("maxPollutionCap")) configuration.maxPollutionCap = machineObject.get("maxPollutionCap").getAsInt(); + if(machineObject.has("fluxMode")) configuration.fluxMode = machineObject.get("fluxMode").getAsBoolean(); configuration.recipeSpeedMult = machineObject.get("recipeSpeedMult").getAsDouble(); configuration.recipeConsumptionMult = machineObject.get("recipeConsumptionMult").getAsDouble(); configuration.maxPower = machineObject.get("maxPower").getAsLong(); - if(machineObject.get("maxHeat")!=null) { - configuration.maxHeat = machineObject.get("maxHeat").getAsInt(); - } - else configuration.maxHeat = 0; + if(machineObject.has("maxHeat")) configuration.maxHeat = machineObject.get("maxHeat").getAsInt(); if(machineObject.has("recipeShape") && machineObject.has("recipeParts")) { - JsonArray recipeShape = machineObject.get("recipeShape").getAsJsonArray(); - JsonArray recipeParts = machineObject.get("recipeParts").getAsJsonArray(); - - Object[] parts = new Object[recipeShape.size() + recipeParts.size()]; - - for(int j = 0; j < recipeShape.size(); j++) { - parts[j] = recipeShape.get(j).getAsString(); - } - - for(int j = 0; j < recipeParts.size(); j++) { - Object o = null; - - if(j % 2 == 0) { - o = recipeParts.get(j).getAsString().charAt(0); //god is dead and we killed him - } else { - AStack a = SerializableRecipe.readAStack(recipeParts.get(j).getAsJsonArray()); - - if(a instanceof ComparableStack) o = ((ComparableStack) a).toStack(); - if(a instanceof OreDictStack) o = ((OreDictStack) a).name; + try { + JsonArray recipeShape = machineObject.get("recipeShape").getAsJsonArray(); + JsonArray recipeParts = machineObject.get("recipeParts").getAsJsonArray(); + + Object[] parts = new Object[recipeShape.size() + recipeParts.size()]; + + for(int j = 0; j < recipeShape.size(); j++) { + parts[j] = recipeShape.get(j).getAsString(); } - - parts[j + recipeShape.size()] = o; + + for(int j = 0; j < recipeParts.size(); j++) { + Object o = null; + + if(j % 2 == 0) { + o = recipeParts.get(j).getAsString().charAt(0); //god is dead and we killed him + } else { + AStack a = SerializableRecipe.readAStack(recipeParts.get(j).getAsJsonArray()); + + if(a instanceof ComparableStack) o = ((ComparableStack) a).toStack(); + if(a instanceof OreDictStack) o = ((OreDictStack) a).name; + } + + parts[j + recipeShape.size()] = o; + } + + ItemStack stack = new ItemStack(ModBlocks.custom_machine, 1, i + 100); + stack.stackTagCompound = new NBTTagCompound(); + stack.stackTagCompound.setString("machineType", configuration.unlocalizedName); + + CraftingManager.addRecipeAuto(stack, parts); + } catch(Exception ex) { + MainRegistry.logger.error("Caught exception trying to parse core recipe for custom machine " + configuration.unlocalizedName); + MainRegistry.logger.error("recipeShape was" + machineObject.get("recipeShape").toString()); + MainRegistry.logger.error("recipeParts was" + machineObject.get("recipeParts").toString()); } - - ItemStack stack = new ItemStack(ModBlocks.custom_machine, 1, i + 100); - stack.stackTagCompound = new NBTTagCompound(); - stack.stackTagCompound.setString("machineType", configuration.unlocalizedName); - - CraftingManager.addRecipeAuto(stack, parts); } JsonArray components = machineObject.get("components").getAsJsonArray(); diff --git a/src/main/java/com/hbm/handler/nei/CustomMachineHandler.java b/src/main/java/com/hbm/handler/nei/CustomMachineHandler.java index d691bf27a..fa3b88f6a 100644 --- a/src/main/java/com/hbm/handler/nei/CustomMachineHandler.java +++ b/src/main/java/com/hbm/handler/nei/CustomMachineHandler.java @@ -84,13 +84,13 @@ public class CustomMachineHandler extends TemplateRecipeHandler { } outputs.add(new PositionedStack(out, 102 + (i - 3) * 18, 42)); } - if(recipe.pollutionMode) { - this.pollutionType = recipe.pollutionType; - this.pollutionAmount = recipe.pollutionAmount; - } - if(recipe.radiationMode) this.radiationAmount = recipe.radiationAmount; + + this.pollutionType = recipe.pollutionType; + this.pollutionAmount = recipe.pollutionAmount; + this.radiationAmount = recipe.radiationAmount; if(conf.fluxMode) this.flux = recipe.flux; - if(conf.maxHeat>0 && recipe.heat>0) this.heat = recipe.heat; + if(conf.maxHeat > 0 && recipe.heat > 0) this.heat = recipe.heat; + this.machine = new PositionedStack(new ItemStack(ModBlocks.custom_machine, 1, 100 + CustomMachineConfigJSON.niceList.indexOf(conf)), 75, 42); } @@ -212,6 +212,7 @@ public class CustomMachineHandler extends TemplateRecipeHandler { @Override public void loadTransferRects() { if(this.conf == null) return; + transferRects.clear(); transferRects.add(new RecipeTransferRect(new Rectangle(65, 23, 36, 18), "ntm_" + conf.unlocalizedName)); RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects); } diff --git a/src/main/java/com/hbm/inventory/gui/GUIElectrolyserFluid.java b/src/main/java/com/hbm/inventory/gui/GUIElectrolyserFluid.java index fa4964eed..914228045 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIElectrolyserFluid.java +++ b/src/main/java/com/hbm/inventory/gui/GUIElectrolyserFluid.java @@ -67,7 +67,7 @@ public class GUIElectrolyserFluid extends GuiInfoContainer { int p = (int) (electrolyser.power * 89 / electrolyser.maxPower); drawTexturedModalRect(guiLeft + 186, guiTop + 107 - p, 210, 89 - p, 16, p); - if(electrolyser.power >= electrolyser.usage) + if(electrolyser.power >= electrolyser.usageFluid) drawTexturedModalRect(guiLeft + 190, guiTop + 4, 226, 40, 9, 12); int e = electrolyser.progressFluid * 41 / electrolyser.processFluidTime; diff --git a/src/main/java/com/hbm/inventory/gui/GUIElectrolyserMetal.java b/src/main/java/com/hbm/inventory/gui/GUIElectrolyserMetal.java index b132811e1..3e4eabfd9 100644 --- a/src/main/java/com/hbm/inventory/gui/GUIElectrolyserMetal.java +++ b/src/main/java/com/hbm/inventory/gui/GUIElectrolyserMetal.java @@ -99,7 +99,7 @@ public class GUIElectrolyserMetal extends GuiInfoContainer { int p = (int) (electrolyser.power * 89 / electrolyser.maxPower); drawTexturedModalRect(guiLeft + 186, guiTop + 107 - p, 210, 89 - p, 16, p); - if(electrolyser.power >= electrolyser.usage) + if(electrolyser.power >= electrolyser.usageOre) drawTexturedModalRect(guiLeft + 190, guiTop + 4, 226, 25, 9, 12); int o = electrolyser.progressOre * 26 / electrolyser.processOreTime; diff --git a/src/main/java/com/hbm/inventory/recipes/ChemplantRecipes.java b/src/main/java/com/hbm/inventory/recipes/ChemplantRecipes.java index 7f88fe3de..319d12250 100644 --- a/src/main/java/com/hbm/inventory/recipes/ChemplantRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/ChemplantRecipes.java @@ -226,10 +226,10 @@ public class ChemplantRecipes extends SerializableRecipe { .inputFluids(new FluidStack(Fluids.PETROLEUM, 200, GeneralConfig.enable528 ? 1 : 0)) .outputItems(new ItemStack(ModItems.rocket_fuel, 4))); recipes.add(new ChemRecipe(58, "ELECTROLYSIS", 150) - .inputFluids(new FluidStack(Fluids.WATER, 8000)) + .inputFluids(new FluidStack(Fluids.WATER, 4000)) .outputFluids( - new FluidStack(Fluids.HYDROGEN, 800), - new FluidStack(Fluids.OXYGEN, 800))); + new FluidStack(Fluids.HYDROGEN, 400), + new FluidStack(Fluids.OXYGEN, 400))); recipes.add(new ChemRecipe(59, "XENON", 300) .inputFluids(new FluidStack(Fluids.NONE, 0)) .outputFluids(new FluidStack(Fluids.XENON, 50))); @@ -371,10 +371,10 @@ public class ChemplantRecipes extends SerializableRecipe { .inputFluids(new FluidStack(Fluids.GAS, 1000)) .outputFluids(new FluidStack(Fluids.CARBONDIOXIDE, 1000))); recipes.add(new ChemRecipe(78, "HEAVY_ELECTROLYSIS", 150) - .inputFluids(new FluidStack(Fluids.HEAVYWATER, 8000)) + .inputFluids(new FluidStack(Fluids.HEAVYWATER, 2000)) .outputFluids( - new FluidStack(Fluids.DEUTERIUM, 400), - new FluidStack(Fluids.OXYGEN, 400))); + new FluidStack(Fluids.DEUTERIUM, 200), + new FluidStack(Fluids.OXYGEN, 200))); recipes.add(new ChemRecipe(80, "EPEARL", 100) .inputItems(new OreDictStack(DIAMOND.dust(), 1)) .inputFluids(new FluidStack(Fluids.XPJUICE, 500)) diff --git a/src/main/java/com/hbm/inventory/recipes/CustomMachineRecipes.java b/src/main/java/com/hbm/inventory/recipes/CustomMachineRecipes.java index 132a48bca..bf9895e2d 100644 --- a/src/main/java/com/hbm/inventory/recipes/CustomMachineRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/CustomMachineRecipes.java @@ -36,10 +36,8 @@ public class CustomMachineRecipes extends SerializableRecipe { recipe.outputItems = new Pair[] {new Pair(new ItemStack(Items.paper, 3), 1F)}; recipe.duration = 60; recipe.consumptionPerTick = 10; - recipe.pollutionMode = true; recipe.pollutionType = "SOOT"; - recipe.pollutionAmount = 0.03f; - recipe.radiationMode = false; + recipe.pollutionAmount = 0.03F; recipe.radiationAmount = 0; recipe.flux = 0; recipe.heat = 0; @@ -80,32 +78,17 @@ public class CustomMachineRecipes extends SerializableRecipe { recipeInstance.duration = rec.get("duration").getAsInt(); recipeInstance.consumptionPerTick = rec.get("consumptionPerTick").getAsInt(); - if(rec.get("pollutionMode")!=null) { - recipeInstance.pollutionMode = rec.get("pollutionMode").getAsBoolean(); + if(rec.has("pollutionType") && rec.has("pollutionAmount")) { recipeInstance.pollutionType = rec.get("pollutionType").getAsString(); recipeInstance.pollutionAmount = rec.get("pollutionAmount").getAsFloat(); - } - else { - recipeInstance.pollutionMode = false; + } else { recipeInstance.pollutionType = ""; - recipeInstance.pollutionAmount = 0; } - if(rec.get("radiationMode")!=null) { - recipeInstance.radiationMode = rec.get("radiationMode").getAsBoolean(); - recipeInstance.radiationAmount = rec.get("radiationAmount").getAsFloat(); - } - else { - recipeInstance.radiationMode = false; - recipeInstance.radiationAmount = 0; - } - if(rec.get("flux")!=null) { - recipeInstance.flux = rec.get("flux").getAsInt(); - } - else recipeInstance.flux = 0; - if(rec.get("heat")!=null) { - recipeInstance.heat = rec.get("heat").getAsInt(); - } - else recipeInstance.heat = 0; + + if(rec.has("radiationAmount")) recipeInstance.radiationAmount = rec.get("radiationAmount").getAsFloat(); + if(rec.has("flux")) recipeInstance.flux = rec.get("flux").getAsInt(); + if(rec.has("heat")) recipeInstance.heat = rec.get("heat").getAsInt(); + list.add(recipeInstance); } @@ -140,10 +123,8 @@ public class CustomMachineRecipes extends SerializableRecipe { writer.name("duration").value(recipeInstance.duration); writer.name("consumptionPerTick").value(recipeInstance.consumptionPerTick); - writer.name("pollutionMode").value(recipeInstance.pollutionMode); writer.name("pollutionType").value(recipeInstance.pollutionType); writer.name("pollutionAmount").value(recipeInstance.pollutionAmount); - writer.name("radiationMode").value(recipeInstance.radiationMode); writer.name("radiationnAmount").value(recipeInstance.radiationAmount); writer.name("flux").value(recipeInstance.flux); writer.name("heat").value(recipeInstance.heat); @@ -163,11 +144,9 @@ public class CustomMachineRecipes extends SerializableRecipe { public int duration; public int consumptionPerTick; - public boolean pollutionMode; public String pollutionType; public float pollutionAmount; - public boolean radiationMode; public float radiationAmount; public int flux; public int heat; diff --git a/src/main/java/com/hbm/inventory/recipes/ElectrolyserFluidRecipes.java b/src/main/java/com/hbm/inventory/recipes/ElectrolyserFluidRecipes.java index 658f0d305..b60884f26 100644 --- a/src/main/java/com/hbm/inventory/recipes/ElectrolyserFluidRecipes.java +++ b/src/main/java/com/hbm/inventory/recipes/ElectrolyserFluidRecipes.java @@ -24,8 +24,8 @@ public class ElectrolyserFluidRecipes extends SerializableRecipe { @Override public void registerDefaults() { - recipes.put(Fluids.WATER, new ElectrolysisRecipe(1_000, new FluidStack(Fluids.HYDROGEN, 100), new FluidStack(Fluids.OXYGEN, 100))); - recipes.put(Fluids.HEAVYWATER, new ElectrolysisRecipe(1_000, new FluidStack(Fluids.DEUTERIUM, 50), new FluidStack(Fluids.OXYGEN, 50))); + recipes.put(Fluids.WATER, new ElectrolysisRecipe(2_000, new FluidStack(Fluids.HYDROGEN, 200), new FluidStack(Fluids.OXYGEN, 200))); + recipes.put(Fluids.HEAVYWATER, new ElectrolysisRecipe(2_000, new FluidStack(Fluids.DEUTERIUM, 200), new FluidStack(Fluids.OXYGEN, 200))); recipes.put(Fluids.POTASSIUM_CHLORIDE, new ElectrolysisRecipe(250, new FluidStack(Fluids.CHLORINE, 125), new FluidStack(Fluids.NONE, 0), new ItemStack(ModItems.dust))); recipes.put(Fluids.CALCIUM_CHLORIDE, new ElectrolysisRecipe(250, new FluidStack(Fluids.CHLORINE, 125), new FluidStack(Fluids.CALCIUM_SOLUTION, 125))); diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java index 784042f5d..92af2a4ed 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCustomMachine.java @@ -259,21 +259,17 @@ public class TileEntityCustomMachine extends TileEntityMachinePolluting implemen return null; } public void pollution(CustomMachineRecipe recipe) { - if (recipe.pollutionMode) { - if (recipe.pollutionAmount > 0) { - this.pollute(PollutionHandler.PollutionType.valueOf(recipe.pollutionType), recipe.pollutionAmount); - } else if (recipe.pollutionAmount < 0 && PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionHandler.PollutionType.valueOf(recipe.pollutionType)) >= -recipe.pollutionAmount) { - PollutionHandler.decrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionHandler.PollutionType.valueOf(recipe.pollutionType), -recipe.pollutionAmount); - } + if(recipe.pollutionAmount > 0) { + this.pollute(PollutionHandler.PollutionType.valueOf(recipe.pollutionType), recipe.pollutionAmount); + } else if(recipe.pollutionAmount < 0 && PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionHandler.PollutionType.valueOf(recipe.pollutionType)) >= -recipe.pollutionAmount) { + PollutionHandler.decrementPollution(worldObj, xCoord, yCoord, zCoord, PollutionHandler.PollutionType.valueOf(recipe.pollutionType), -recipe.pollutionAmount); } } public void radiation(CustomMachineRecipe recipe){ - if (recipe.radiationMode) { - if (recipe.radiationAmount > 0) { - ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, recipe.radiationAmount); - } else if (recipe.radiationAmount < 0) { - ChunkRadiationManager.proxy.decrementRad(worldObj, xCoord, yCoord, zCoord, -recipe.radiationAmount); - } + if(recipe.radiationAmount > 0) { + ChunkRadiationManager.proxy.incrementRad(worldObj, xCoord, yCoord, zCoord, recipe.radiationAmount); + } else if (recipe.radiationAmount < 0) { + ChunkRadiationManager.proxy.decrementRad(worldObj, xCoord, yCoord, zCoord, -recipe.radiationAmount); } } protected void tryPullHeat(int x, int y, int z) { diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java index 749487b2b..b41f54a7d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityElectrolyser.java @@ -53,11 +53,13 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn public long power; public static final long maxPower = 20000000; - public static final int usageBase = 10000; - public int usage; + public static final int usageOreBase = 10_000; + public static final int usageFluidBase = 10_000; + public int usageOre; + public int usageFluid; public int progressFluid; - public static final int processFluidTimeBase = 60; + public static final int processFluidTimeBase = 20; public int processFluidTime; public int progressOre; public static final int processOreTimeBase = 600; @@ -136,11 +138,12 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn processFluidTime = processFluidTimeBase - processFluidTimeBase * speedLevel / 4; processOreTime = processOreTimeBase - processOreTimeBase * speedLevel / 4; - usage = usageBase - usageBase * powerLevel / 4; + usageOre = usageOreBase - usageOreBase * powerLevel / 4; + usageFluid = usageFluidBase - usageFluidBase * powerLevel / 4; if(this.canProcessFluid()) { this.progressFluid++; - this.power -= this.usage; + this.power -= this.usageFluid; if(this.progressFluid >= this.processFluidTime) { this.processFluids(); @@ -151,7 +154,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn if(this.canProcesMetal()) { this.progressOre++; - this.power -= this.usage; + this.power -= this.usageOre; if(this.progressOre >= this.processOreTime) { this.processMetal(); @@ -210,7 +213,8 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn data.setLong("power", this.power); data.setInteger("progressFluid", this.progressFluid); data.setInteger("progressOre", this.progressOre); - data.setInteger("usage", this.usage); + data.setInteger("usageOre", this.usageOre); + data.setInteger("usageFluid", this.usageFluid); data.setInteger("processFluidTime", this.processFluidTime); data.setInteger("processOreTime", this.processOreTime); if(this.leftStack != null) { @@ -247,7 +251,8 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn this.power = nbt.getLong("power"); this.progressFluid = nbt.getInteger("progressFluid"); this.progressOre = nbt.getInteger("progressOre"); - this.usage = nbt.getInteger("usage"); + this.usageOre = nbt.getInteger("usageOre"); + this.usageFluid = nbt.getInteger("usageFluid"); this.processFluidTime = nbt.getInteger("processFluidTime"); this.processOreTime = nbt.getInteger("processOreTime"); if(nbt.hasKey("leftType")) this.leftStack = new MaterialStack(Mats.matById.get(nbt.getInteger("leftType")), nbt.getInteger("leftAmount")); @@ -259,7 +264,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn public boolean canProcessFluid() { - if(this.power < usage) return false; + if(this.power < usageFluid) return false; ElectrolysisRecipe recipe = ElectrolyserFluidRecipes.recipes.get(tanks[0].getTankType()); @@ -310,7 +315,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn public boolean canProcesMetal() { if(slots[14] == null) return false; - if(this.power < usage) return false; + if(this.power < usageOre) return false; if(this.tanks[3].getFill() < 100) return false; ElectrolysisMetalRecipe recipe = ElectrolyserMetalRecipes.getRecipe(slots[14]); @@ -382,7 +387,6 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn this.power = nbt.getLong("power"); this.progressFluid = nbt.getInteger("progressFluid"); this.progressOre = nbt.getInteger("progressOre"); - this.usage = nbt.getInteger("usage"); this.processFluidTime = nbt.getInteger("processFluidTime"); this.processOreTime = nbt.getInteger("processOreTime"); if(nbt.hasKey("leftType")) this.leftStack = new MaterialStack(Mats.matById.get(nbt.getInteger("leftType")), nbt.getInteger("leftAmount")); @@ -399,7 +403,6 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn nbt.setLong("power", this.power); nbt.setInteger("progressFluid", this.progressFluid); nbt.setInteger("progressOre", this.progressOre); - nbt.setInteger("usage", this.usage); nbt.setInteger("processFluidTime", this.processFluidTime); nbt.setInteger("processOreTime", this.processOreTime); if(this.leftStack != null) {