mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Merge pull request #1571 from 70000hp/electrolyzer-improvements
Electrolyzer Improvements part 1
This commit is contained in:
commit
958a099bac
@ -10,8 +10,10 @@ import com.google.gson.JsonElement;
|
|||||||
import com.google.gson.JsonObject;
|
import com.google.gson.JsonObject;
|
||||||
import com.google.gson.stream.JsonWriter;
|
import com.google.gson.stream.JsonWriter;
|
||||||
import com.hbm.inventory.FluidStack;
|
import com.hbm.inventory.FluidStack;
|
||||||
|
import com.hbm.inventory.RecipesCommon;
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
import com.hbm.inventory.fluid.Fluids;
|
import com.hbm.inventory.fluid.Fluids;
|
||||||
|
import com.hbm.inventory.material.Mats;
|
||||||
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||||
import com.hbm.items.ModItems;
|
import com.hbm.items.ModItems;
|
||||||
import com.hbm.items.machine.ItemFluidIcon;
|
import com.hbm.items.machine.ItemFluidIcon;
|
||||||
@ -24,9 +26,10 @@ public class ElectrolyserFluidRecipes extends SerializableRecipe {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerDefaults() {
|
public void registerDefaults() {
|
||||||
recipes.put(Fluids.WATER, new ElectrolysisRecipe(2_000, new FluidStack(Fluids.HYDROGEN, 200), new FluidStack(Fluids.OXYGEN, 200)));
|
recipes.put(Fluids.WATER, new ElectrolysisRecipe(2_000, new FluidStack(Fluids.HYDROGEN, 200), new FluidStack(Fluids.OXYGEN, 200),10));
|
||||||
recipes.put(Fluids.HEAVYWATER, new ElectrolysisRecipe(2_000, new FluidStack(Fluids.DEUTERIUM, 200), new FluidStack(Fluids.OXYGEN, 200)));
|
recipes.put(Fluids.HEAVYWATER, new ElectrolysisRecipe(2_000, new FluidStack(Fluids.DEUTERIUM, 200), new FluidStack(Fluids.OXYGEN, 200), 10));
|
||||||
recipes.put(Fluids.VITRIOL, new ElectrolysisRecipe(1_000, new FluidStack(Fluids.SULFURIC_ACID, 500), new FluidStack(Fluids.CHLORINE, 500), new ItemStack(ModItems.powder_iron), new ItemStack(ModItems.ingot_mercury)));
|
recipes.put(Fluids.VITRIOL, new ElectrolysisRecipe(1_000, new FluidStack(Fluids.SULFURIC_ACID, 500), new FluidStack(Fluids.CHLORINE, 500), new ItemStack(ModItems.powder_iron), new ItemStack(ModItems.ingot_mercury)));
|
||||||
|
recipes.put(Fluids.SLOP, new ElectrolysisRecipe(1_000, new FluidStack(Fluids.MERCURY, 250), new FluidStack(Fluids.NONE, 0), new ItemStack(ModItems.niter, 2), new ItemStack(ModItems.powder_limestone, 2), new ItemStack(ModItems.sulfur)));
|
||||||
|
|
||||||
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.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)));
|
recipes.put(Fluids.CALCIUM_CHLORIDE, new ElectrolysisRecipe(250, new FluidStack(Fluids.CHLORINE, 125), new FluidStack(Fluids.CALCIUM_SOLUTION, 125)));
|
||||||
@ -50,6 +53,11 @@ public class ElectrolyserFluidRecipes extends SerializableRecipe {
|
|||||||
|
|
||||||
return recipes;
|
return recipes;
|
||||||
}
|
}
|
||||||
|
public static ElectrolysisRecipe getRecipe(FluidType type) {
|
||||||
|
if(type == null)
|
||||||
|
return null;
|
||||||
|
return recipes.get(type);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getFileName() {
|
public String getFileName() {
|
||||||
@ -100,12 +108,23 @@ public class ElectrolyserFluidRecipes extends SerializableRecipe {
|
|||||||
public FluidStack output2;
|
public FluidStack output2;
|
||||||
public int amount;
|
public int amount;
|
||||||
public ItemStack[] byproduct;
|
public ItemStack[] byproduct;
|
||||||
|
public int duration;
|
||||||
|
|
||||||
public ElectrolysisRecipe(int amount, FluidStack output1, FluidStack output2, ItemStack... byproduct) {
|
public ElectrolysisRecipe(int amount, FluidStack output1, FluidStack output2, ItemStack... byproduct) {
|
||||||
this.output1 = output1;
|
this.output1 = output1;
|
||||||
this.output2 = output2;
|
this.output2 = output2;
|
||||||
this.amount = amount;
|
this.amount = amount;
|
||||||
this.byproduct = byproduct;
|
this.byproduct = byproduct;
|
||||||
|
duration = 20;
|
||||||
|
}
|
||||||
|
public ElectrolysisRecipe(int amount, FluidStack output1, FluidStack output2, int duration, ItemStack... byproduct) {
|
||||||
|
this.output1 = output1;
|
||||||
|
this.output2 = output2;
|
||||||
|
this.amount = amount;
|
||||||
|
this.byproduct = byproduct;
|
||||||
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import com.hbm.items.machine.ItemScraps;
|
|||||||
import com.hbm.items.special.ItemBedrockOreNew;
|
import com.hbm.items.special.ItemBedrockOreNew;
|
||||||
import com.hbm.items.special.ItemBedrockOreNew.BedrockOreGrade;
|
import com.hbm.items.special.ItemBedrockOreNew.BedrockOreGrade;
|
||||||
import com.hbm.items.special.ItemBedrockOreNew.BedrockOreType;
|
import com.hbm.items.special.ItemBedrockOreNew.BedrockOreType;
|
||||||
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.ItemStackUtil;
|
import com.hbm.util.ItemStackUtil;
|
||||||
|
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
@ -134,22 +135,23 @@ public class ElectrolyserMetalRecipes extends SerializableRecipe {
|
|||||||
|
|
||||||
for(BedrockOreType type : BedrockOreType.values()) {
|
for(BedrockOreType type : BedrockOreType.values()) {
|
||||||
|
|
||||||
MaterialStack f0 = ItemBedrockOreNew.toFluid(type.primary1, MaterialShapes.INGOT.q(12));
|
MaterialStack f0 = ItemBedrockOreNew.toFluid(type.primary1, MaterialShapes.INGOT.q(7));
|
||||||
MaterialStack f1 = ItemBedrockOreNew.toFluid(type.primary2, MaterialShapes.INGOT.q(6));
|
MaterialStack f1 = ItemBedrockOreNew.toFluid(type.primary2, MaterialShapes.INGOT.q(4));
|
||||||
recipes.put(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.PRIMARY_FIRST, type)), new ElectrolysisMetalRecipe(
|
recipes.put(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.PRIMARY_FIRST, type)), new ElectrolysisMetalRecipe(
|
||||||
f0 != null ? f0 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1)),
|
f0 != null ? f0 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1)),
|
||||||
f1 != null ? f1 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1)),
|
f1 != null ? f1 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1)),
|
||||||
f0 == null ? ItemBedrockOreNew.extract(type.primary1, 12) : new ItemStack(ModItems.dust),
|
20,
|
||||||
f1 == null ? ItemBedrockOreNew.extract(type.primary2, 6) : new ItemStack(ModItems.dust),
|
f0 == null ? ItemBedrockOreNew.extract(type.primary1, 7) : new ItemStack(ModItems.dust),
|
||||||
|
f1 == null ? ItemBedrockOreNew.extract(type.primary2, 4) : new ItemStack(ModItems.dust),
|
||||||
ItemBedrockOreNew.make(BedrockOreGrade.CRUMBS, type)));
|
ItemBedrockOreNew.make(BedrockOreGrade.CRUMBS, type)));
|
||||||
|
MaterialStack s0 = ItemBedrockOreNew.toFluid(type.primary1, MaterialShapes.INGOT.q(4));
|
||||||
MaterialStack s0 = ItemBedrockOreNew.toFluid(type.primary1, MaterialShapes.INGOT.q(6));
|
MaterialStack s1 = ItemBedrockOreNew.toFluid(type.primary2, MaterialShapes.INGOT.q(7));
|
||||||
MaterialStack s1 = ItemBedrockOreNew.toFluid(type.primary2, MaterialShapes.INGOT.q(12));
|
|
||||||
recipes.put(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.PRIMARY_SECOND, type)), new ElectrolysisMetalRecipe(
|
recipes.put(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.PRIMARY_SECOND, type)), new ElectrolysisMetalRecipe(
|
||||||
s0 != null ? s0 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1)),
|
s0 != null ? s0 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1)),
|
||||||
s1 != null ? s1 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1)),
|
s1 != null ? s1 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1)),
|
||||||
s0 == null ? ItemBedrockOreNew.extract(type.primary1, 12) : new ItemStack(ModItems.dust),
|
20,
|
||||||
s1 == null ? ItemBedrockOreNew.extract(type.primary2, 6) : new ItemStack(ModItems.dust),
|
s0 == null ? ItemBedrockOreNew.extract(type.primary1, 4) : new ItemStack(ModItems.dust),
|
||||||
|
s1 == null ? ItemBedrockOreNew.extract(type.primary2, 7) : new ItemStack(ModItems.dust),
|
||||||
ItemBedrockOreNew.make(BedrockOreGrade.CRUMBS, type)));
|
ItemBedrockOreNew.make(BedrockOreGrade.CRUMBS, type)));
|
||||||
|
|
||||||
MaterialStack c0 = ItemBedrockOreNew.toFluid(type.primary1, MaterialShapes.INGOT.q(2));
|
MaterialStack c0 = ItemBedrockOreNew.toFluid(type.primary1, MaterialShapes.INGOT.q(2));
|
||||||
@ -157,12 +159,15 @@ public class ElectrolyserMetalRecipes extends SerializableRecipe {
|
|||||||
recipes.put(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.CRUMBS, type)), new ElectrolysisMetalRecipe(
|
recipes.put(new ComparableStack(ItemBedrockOreNew.make(BedrockOreGrade.CRUMBS, type)), new ElectrolysisMetalRecipe(
|
||||||
c0 != null ? c0 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1, 2)),
|
c0 != null ? c0 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1, 2)),
|
||||||
c1 != null ? c1 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1, 2)),
|
c1 != null ? c1 : new MaterialStack(Mats.MAT_SLAG, MaterialShapes.INGOT.q(1, 2)),
|
||||||
|
20,
|
||||||
c0 == null ? ItemBedrockOreNew.extract(type.primary1, 2) : new ItemStack(ModItems.dust),
|
c0 == null ? ItemBedrockOreNew.extract(type.primary1, 2) : new ItemStack(ModItems.dust),
|
||||||
c1 == null ? ItemBedrockOreNew.extract(type.primary2, 2) : new ItemStack(ModItems.dust)));
|
c1 == null ? ItemBedrockOreNew.extract(type.primary2, 2) : new ItemStack(ModItems.dust)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ElectrolysisMetalRecipe getRecipe(ItemStack stack) {
|
public static ElectrolysisMetalRecipe getRecipe(ItemStack stack) {
|
||||||
|
if(stack == null || stack.getItem() == null)
|
||||||
|
return null;
|
||||||
|
|
||||||
ComparableStack comp = new ComparableStack(stack).makeSingular();
|
ComparableStack comp = new ComparableStack(stack).makeSingular();
|
||||||
|
|
||||||
@ -180,7 +185,7 @@ public class ElectrolyserMetalRecipes extends SerializableRecipe {
|
|||||||
|
|
||||||
public static HashMap getRecipes() {
|
public static HashMap getRecipes() {
|
||||||
|
|
||||||
HashMap<Object[], Object[]> recipes = new HashMap<Object[], Object[]>();
|
HashMap<Object[], Object[]> recipes = new HashMap<>();
|
||||||
|
|
||||||
for(Entry<AStack, ElectrolysisMetalRecipe> entry : ElectrolyserMetalRecipes.recipes.entrySet()) {
|
for(Entry<AStack, ElectrolysisMetalRecipe> entry : ElectrolyserMetalRecipes.recipes.entrySet()) {
|
||||||
|
|
||||||
@ -266,11 +271,19 @@ public class ElectrolyserMetalRecipes extends SerializableRecipe {
|
|||||||
public MaterialStack output1;
|
public MaterialStack output1;
|
||||||
public MaterialStack output2;
|
public MaterialStack output2;
|
||||||
public ItemStack[] byproduct;
|
public ItemStack[] byproduct;
|
||||||
|
public int duration;
|
||||||
|
|
||||||
public ElectrolysisMetalRecipe(MaterialStack output1, MaterialStack output2, ItemStack... byproduct) {
|
public ElectrolysisMetalRecipe(MaterialStack output1, MaterialStack output2, ItemStack... byproduct) {
|
||||||
this.output1 = output1;
|
this.output1 = output1;
|
||||||
this.output2 = output2;
|
this.output2 = output2;
|
||||||
this.byproduct = byproduct;
|
this.byproduct = byproduct;
|
||||||
|
duration = 600;
|
||||||
|
}
|
||||||
|
public ElectrolysisMetalRecipe(MaterialStack output1, MaterialStack output2, int duration, ItemStack... byproduct) {
|
||||||
|
this.output1 = output1;
|
||||||
|
this.output2 = output2;
|
||||||
|
this.byproduct = byproduct;
|
||||||
|
this.duration = duration;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,6 +16,7 @@ import com.hbm.inventory.gui.GUIElectrolyserMetal;
|
|||||||
import com.hbm.inventory.material.MaterialShapes;
|
import com.hbm.inventory.material.MaterialShapes;
|
||||||
import com.hbm.inventory.material.Mats;
|
import com.hbm.inventory.material.Mats;
|
||||||
import com.hbm.inventory.material.Mats.MaterialStack;
|
import com.hbm.inventory.material.Mats.MaterialStack;
|
||||||
|
import com.hbm.inventory.recipes.CrystallizerRecipes;
|
||||||
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes;
|
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes;
|
||||||
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes.ElectrolysisRecipe;
|
import com.hbm.inventory.recipes.ElectrolyserFluidRecipes.ElectrolysisRecipe;
|
||||||
import com.hbm.inventory.recipes.ElectrolyserMetalRecipes;
|
import com.hbm.inventory.recipes.ElectrolyserMetalRecipes;
|
||||||
@ -28,6 +29,7 @@ import com.hbm.packet.PacketDispatcher;
|
|||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.IUpgradeInfoProvider;
|
import com.hbm.tileentity.IUpgradeInfoProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.BobMathUtil;
|
||||||
import com.hbm.util.CrucibleUtil;
|
import com.hbm.util.CrucibleUtil;
|
||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
import com.hbm.util.fauxpointtwelve.DirPos;
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
@ -59,11 +61,9 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
public int usageFluid;
|
public int usageFluid;
|
||||||
|
|
||||||
public int progressFluid;
|
public int progressFluid;
|
||||||
public static final int processFluidTimeBase = 20;
|
public int processFluidTime = 100;
|
||||||
public int processFluidTime;
|
|
||||||
public int progressOre;
|
public int progressOre;
|
||||||
public static final int processOreTimeBase = 600;
|
public int processOreTime = 600;
|
||||||
public int processOreTime;
|
|
||||||
|
|
||||||
public MaterialStack leftStack;
|
public MaterialStack leftStack;
|
||||||
public MaterialStack rightStack;
|
public MaterialStack rightStack;
|
||||||
@ -136,30 +136,30 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
int speedLevel = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3);
|
||||||
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
int powerLevel = Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 3);
|
||||||
|
|
||||||
processFluidTime = processFluidTimeBase - processFluidTimeBase * speedLevel / 4;
|
|
||||||
processOreTime = processOreTimeBase - processOreTimeBase * speedLevel / 4;
|
|
||||||
usageOre = usageOreBase - usageOreBase * powerLevel / 4;
|
usageOre = usageOreBase - usageOreBase * powerLevel / 4;
|
||||||
usageFluid = usageFluidBase - usageFluidBase * powerLevel / 4;
|
usageFluid = usageFluidBase - usageFluidBase * powerLevel / 4;
|
||||||
|
|
||||||
if(this.canProcessFluid()) {
|
for(int i = 0; i < getCycleCount(); i++) {
|
||||||
this.progressFluid++;
|
if (this.canProcessFluid()) {
|
||||||
this.power -= this.usageFluid;
|
this.progressFluid++;
|
||||||
|
this.power -= this.usageFluid;
|
||||||
|
|
||||||
if(this.progressFluid >= this.processFluidTime) {
|
if (this.progressFluid >= this.getDurationFluid()) {
|
||||||
this.processFluids();
|
this.processFluids();
|
||||||
this.progressFluid = 0;
|
this.progressFluid = 0;
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if(this.canProcesMetal()) {
|
if (this.canProcessMetal()) {
|
||||||
this.progressOre++;
|
this.progressOre++;
|
||||||
this.power -= this.usageOre;
|
this.power -= this.usageOre;
|
||||||
|
|
||||||
if(this.progressOre >= this.processOreTime) {
|
if (this.progressOre >= this.getDurationMetal()) {
|
||||||
this.processMetal();
|
this.processMetal();
|
||||||
this.progressOre = 0;
|
this.progressOre = 0;
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,7 +170,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
toCast.add(this.leftStack);
|
toCast.add(this.leftStack);
|
||||||
|
|
||||||
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
|
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
|
||||||
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3), impact);
|
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3) * Math.max (getCycleCount() * speedLevel, 1), impact);
|
||||||
|
|
||||||
if(didPour != null) {
|
if(didPour != null) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
@ -193,7 +193,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
toCast.add(this.rightStack);
|
toCast.add(this.rightStack);
|
||||||
|
|
||||||
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
|
Vec3 impact = Vec3.createVectorHelper(0, 0, 0);
|
||||||
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3), impact);
|
MaterialStack didPour = CrucibleUtil.pourFullStack(worldObj, xCoord + 0.5D + dir.offsetX * 5.875D, yCoord + 2D, zCoord + 0.5D + dir.offsetZ * 5.875D, 6, true, toCast, MaterialShapes.NUGGET.q(3) * Math.max (getCycleCount() * speedLevel, 1), impact);
|
||||||
|
|
||||||
if(didPour != null) {
|
if(didPour != null) {
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
@ -215,8 +215,8 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
data.setInteger("progressOre", this.progressOre);
|
data.setInteger("progressOre", this.progressOre);
|
||||||
data.setInteger("usageOre", this.usageOre);
|
data.setInteger("usageOre", this.usageOre);
|
||||||
data.setInteger("usageFluid", this.usageFluid);
|
data.setInteger("usageFluid", this.usageFluid);
|
||||||
data.setInteger("processFluidTime", this.processFluidTime);
|
data.setInteger("processFluidTime", this.getDurationFluid());
|
||||||
data.setInteger("processOreTime", this.processOreTime);
|
data.setInteger("processOreTime", this.getDurationMetal());
|
||||||
if(this.leftStack != null) {
|
if(this.leftStack != null) {
|
||||||
data.setInteger("leftType", leftStack.material.id);
|
data.setInteger("leftType", leftStack.material.id);
|
||||||
data.setInteger("leftAmount", leftStack.amount);
|
data.setInteger("leftAmount", leftStack.amount);
|
||||||
@ -312,7 +312,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canProcesMetal() {
|
public boolean canProcessMetal() {
|
||||||
|
|
||||||
if(slots[14] == null) return false;
|
if(slots[14] == null) return false;
|
||||||
if(this.power < usageOre) return false;
|
if(this.power < usageOre) return false;
|
||||||
@ -380,6 +380,25 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
this.decrStackSize(14, 1);
|
this.decrStackSize(14, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getDurationMetal() {
|
||||||
|
ElectrolysisMetalRecipe result = ElectrolyserMetalRecipes.getRecipe(slots[14]);
|
||||||
|
int base = result != null ? result.duration : 600;
|
||||||
|
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) - Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 1);
|
||||||
|
return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2)));
|
||||||
|
}
|
||||||
|
public int getDurationFluid() {
|
||||||
|
ElectrolysisRecipe result = ElectrolyserFluidRecipes.getRecipe(tanks[0].getTankType());
|
||||||
|
int base = result != null ? result.duration : 100;
|
||||||
|
int speed = Math.min(UpgradeManager.getLevel(UpgradeType.SPEED), 3) - Math.min(UpgradeManager.getLevel(UpgradeType.POWER), 1);
|
||||||
|
return (int) Math.ceil((base * Math.max(1F - 0.25F * speed, 0.2)));
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getCycleCount() {
|
||||||
|
int speed = UpgradeManager.getLevel(UpgradeType.OVERDRIVE);
|
||||||
|
return Math.min(1 + speed * 2, 7);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void readFromNBT(NBTTagCompound nbt) {
|
public void readFromNBT(NBTTagCompound nbt) {
|
||||||
super.readFromNBT(nbt);
|
super.readFromNBT(nbt);
|
||||||
@ -403,8 +422,8 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
nbt.setLong("power", this.power);
|
nbt.setLong("power", this.power);
|
||||||
nbt.setInteger("progressFluid", this.progressFluid);
|
nbt.setInteger("progressFluid", this.progressFluid);
|
||||||
nbt.setInteger("progressOre", this.progressOre);
|
nbt.setInteger("progressOre", this.progressOre);
|
||||||
nbt.setInteger("processFluidTime", this.processFluidTime);
|
nbt.setInteger("processFluidTime", getDurationFluid());
|
||||||
nbt.setInteger("processOreTime", this.processOreTime);
|
nbt.setInteger("processOreTime", getDurationMetal());
|
||||||
if(this.leftStack != null) {
|
if(this.leftStack != null) {
|
||||||
nbt.setInteger("leftType", leftStack.material.id);
|
nbt.setInteger("leftType", leftStack.material.id);
|
||||||
nbt.setInteger("leftAmount", leftStack.amount);
|
nbt.setInteger("leftAmount", leftStack.amount);
|
||||||
@ -414,6 +433,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
nbt.setInteger("rightAmount", rightStack.amount);
|
nbt.setInteger("rightAmount", rightStack.amount);
|
||||||
}
|
}
|
||||||
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(nbt, "t" + i);
|
for(int i = 0; i < 4; i++) tanks[i].writeToNBT(nbt, "t" + i);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
AxisAlignedBB bb = null;
|
AxisAlignedBB bb = null;
|
||||||
@ -501,7 +521,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
|
public boolean canProvideInfo(UpgradeType type, int level, boolean extendedInfo) {
|
||||||
return type == UpgradeType.SPEED || type == UpgradeType.POWER;
|
return type == UpgradeType.SPEED || type == UpgradeType.POWER || type == UpgradeType.OVERDRIVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -509,9 +529,14 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_electrolyser));
|
info.add(IUpgradeInfoProvider.getStandardLabel(ModBlocks.machine_electrolyser));
|
||||||
if(type == UpgradeType.SPEED) {
|
if(type == UpgradeType.SPEED) {
|
||||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(this.KEY_DELAY, "-" + (level * 25) + "%"));
|
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(this.KEY_DELAY, "-" + (level * 25) + "%"));
|
||||||
|
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(this.KEY_CONSUMPTION, "+" + (level * 100) + "%"));
|
||||||
}
|
}
|
||||||
if(type == UpgradeType.POWER) {
|
if(type == UpgradeType.POWER) {
|
||||||
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(this.KEY_CONSUMPTION, "-" + (level * 25) + "%"));
|
info.add(EnumChatFormatting.GREEN + I18nUtil.resolveKey(this.KEY_CONSUMPTION, "-" + (level * 25) + "%"));
|
||||||
|
info.add(EnumChatFormatting.RED + I18nUtil.resolveKey(this.KEY_DELAY, "+" + (25) + "%"));
|
||||||
|
}
|
||||||
|
if(type == UpgradeType.OVERDRIVE) {
|
||||||
|
info.add((BobMathUtil.getBlink() ? EnumChatFormatting.RED : EnumChatFormatting.DARK_GRAY) + "YES");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -519,6 +544,7 @@ public class TileEntityElectrolyser extends TileEntityMachineBase implements IEn
|
|||||||
public int getMaxLevel(UpgradeType type) {
|
public int getMaxLevel(UpgradeType type) {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
if(type == UpgradeType.SPEED) return 3;
|
||||||
if(type == UpgradeType.POWER) return 3;
|
if(type == UpgradeType.POWER) return 3;
|
||||||
|
if(type == UpgradeType.OVERDRIVE) return 3;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -391,7 +391,7 @@ public class TileEntityMachineCrystallizer extends TileEntityMachineBase impleme
|
|||||||
public int getMaxLevel(UpgradeType type) {
|
public int getMaxLevel(UpgradeType type) {
|
||||||
if(type == UpgradeType.SPEED) return 3;
|
if(type == UpgradeType.SPEED) return 3;
|
||||||
if(type == UpgradeType.EFFECT) return 3;
|
if(type == UpgradeType.EFFECT) return 3;
|
||||||
if(type == UpgradeType.OVERDRIVE) return 2;
|
if(type == UpgradeType.OVERDRIVE) return 3;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user