mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
radiolysis 2
This commit is contained in:
parent
6014609f9f
commit
1e7cf79789
@ -162,6 +162,9 @@ public class MineralRecipes {
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_po210be, 1), new Object[] { "nuggetPolonium210", "nuggetPolonium210", "nuggetPolonium210", ModItems.nugget_beryllium, ModItems.nugget_beryllium, ModItems.nugget_beryllium }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_pu238be, 1), new Object[] { "nuggetPlutonium238", "nuggetPlutonium238", "nuggetPlutonium238", ModItems.nugget_beryllium, ModItems.nugget_beryllium, ModItems.nugget_beryllium }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_ra226be, 1), new Object[] { "nuggetRadium226", "nuggetRadium226", "nuggetRadium226", ModItems.nugget_beryllium, ModItems.nugget_beryllium, ModItems.nugget_beryllium }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_po210be, 2), new Object[] { ModItems.billet_polonium, ModItems.billet_beryllium }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_pu238be, 2), new Object[] { ModItems.billet_pu238, ModItems.billet_beryllium }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_ra226be, 2), new Object[] { ModItems.billet_ra226, ModItems.billet_beryllium }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_po210be, 6), new Object[] { ModItems.billet_polonium, ModItems.billet_polonium, ModItems.billet_polonium, ModItems.billet_beryllium, ModItems.billet_beryllium, ModItems.billet_beryllium }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_pu238be, 6), new Object[] { ModItems.billet_pu238, ModItems.billet_pu238, ModItems.billet_pu238, ModItems.billet_beryllium, ModItems.billet_beryllium, ModItems.billet_beryllium }));
|
||||
GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(ModItems.billet_ra226be, 6), new Object[] { ModItems.billet_ra226, ModItems.billet_ra226, ModItems.billet_ra226, ModItems.billet_beryllium, ModItems.billet_beryllium, ModItems.billet_beryllium }));
|
||||
|
||||
@ -251,8 +251,8 @@ public class HazardRegistry {
|
||||
registerOtherFuel(plate_fuel_mox, mox * ingot, mox * ingot * 100, false);
|
||||
registerOtherFuel(plate_fuel_pu239, pu239 * ingot, pu239 * ingot * 100, false);
|
||||
registerOtherFuel(plate_fuel_sa326, sa326 * ingot, sa326 * ingot * 100, true);
|
||||
registerOtherFuel(plate_fuel_ra226be, rabe * ingot, po210 * nugget * 3, false);
|
||||
registerOtherFuel(plate_fuel_pu238be, pube * ingot, pu238 * nugget, false);
|
||||
registerOtherFuel(plate_fuel_ra226be, rabe * billet, po210 * nugget * 3, false);
|
||||
registerOtherFuel(plate_fuel_pu238be, pube * billet, pu238 * nugget, false);
|
||||
|
||||
registerOtherWaste(waste_plate_u233, u233 * ingot * 100);
|
||||
registerOtherWaste(waste_plate_u235, u235 * ingot * 100);
|
||||
@ -320,6 +320,7 @@ public class HazardRegistry {
|
||||
registerRTGPellet(pellet_rtg_radium, ra226 * rtg, 0);
|
||||
registerRTGPellet(pellet_rtg_weak, (pu238 + (u238 * 2)) * billet, 0);
|
||||
registerRTGPellet(pellet_rtg_strontium, sr90 * rtg, 0);
|
||||
registerRTGPellet(pellet_rtg_cobalt, co60 * rtg, 0);
|
||||
registerRTGPellet(pellet_rtg_actinium, ac227 * rtg, 0);
|
||||
registerRTGPellet(pellet_rtg_polonium, po210 * rtg, 0, 3F);
|
||||
registerRTGPellet(pellet_rtg_lead, pb209 * rtg, 0, 7F, 5F);
|
||||
@ -329,10 +330,13 @@ public class HazardRegistry {
|
||||
|
||||
registerBreedingRodRadiation(BreedingRodType.TRITIUM, 0.001F);
|
||||
registerBreedingRodRadiation(BreedingRodType.CO60, co60);
|
||||
registerBreedingRodRadiation(BreedingRodType.RA226, ra226);
|
||||
registerBreedingRodRadiation(BreedingRodType.AC227, ac227);
|
||||
registerBreedingRodRadiation(BreedingRodType.TH232, th232);
|
||||
registerBreedingRodRadiation(BreedingRodType.THF, thf);
|
||||
registerBreedingRodRadiation(BreedingRodType.U235, u235);
|
||||
registerBreedingRodRadiation(BreedingRodType.NP237, np237);
|
||||
registerBreedingRodRadiation(BreedingRodType.U238, u238);
|
||||
registerBreedingRodRadiation(BreedingRodType.PU238, pu238); //it's in a container :)
|
||||
registerBreedingRodRadiation(BreedingRodType.PU239, pu239);
|
||||
registerBreedingRodRadiation(BreedingRodType.RGP, purg);
|
||||
|
||||
@ -0,0 +1,51 @@
|
||||
package com.hbm.inventory.recipes;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.machine.ItemFluidIcon;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class RadiolysisRecipes {
|
||||
//All cracking recipes, + 2H2O => H2O2 + H2, + heavy oil => light oil + waste product, and others i haven't even thought of yet
|
||||
|
||||
private static Map<FluidType, Pair<FluidStack, FluidStack>> radiolysis = new HashMap(); //fluidstacks :reimumunch:
|
||||
|
||||
/* I am proud of this but I don't think I should be */
|
||||
public static Map<Object, Object[]> getRecipesForNEI() {
|
||||
Map<Object, Object[]> recipes = new HashMap<Object, Object[]>();
|
||||
Iterator key = radiolysis.entrySet().iterator();
|
||||
Iterator values = radiolysis.values().iterator();
|
||||
|
||||
while(key.hasNext() && values.hasNext()) {
|
||||
Pair<FluidStack, FluidStack> pair = (Pair<FluidStack, FluidStack>) values.next();
|
||||
|
||||
recipes.put(ItemFluidIcon.make((FluidType) key.next(), 100),
|
||||
new ItemStack[] {
|
||||
ItemFluidIcon.make(pair.getKey().type, pair.getKey().fill),
|
||||
ItemFluidIcon.make(pair.getValue().type, pair.getValue().fill) });
|
||||
}
|
||||
|
||||
return recipes;
|
||||
}
|
||||
|
||||
public static void registerRadiolysis() {
|
||||
radiolysis.put(Fluids.WATER, new Pair(new FluidStack(80, Fluids.ACID), new FluidStack(20, Fluids.HYDROGEN)));
|
||||
|
||||
radiolysis.put(Fluids.BITUMEN, new Pair(new FluidStack(80, Fluids.OIL), new FluidStack(20, Fluids.PETROLEUM)));
|
||||
radiolysis.put(Fluids.SMEAR, new Pair(new FluidStack(60, Fluids.NAPHTHA), new FluidStack(40, Fluids.PETROLEUM)));
|
||||
radiolysis.put(Fluids.GAS, new Pair(new FluidStack(50, Fluids.PETROLEUM), new FluidStack(0, Fluids.NONE)));
|
||||
radiolysis.put(Fluids.DIESEL, new Pair(new FluidStack(40, Fluids.KEROSENE), new FluidStack(30, Fluids.PETROLEUM)));
|
||||
radiolysis.put(Fluids.KEROSENE, new Pair(new FluidStack(60, Fluids.PETROLEUM), new FluidStack(0, Fluids.NONE)));
|
||||
}
|
||||
|
||||
public static Pair<FluidStack, FluidStack> getRadiolysis(FluidType input) {
|
||||
return radiolysis.get(input);
|
||||
}
|
||||
}
|
||||
@ -2641,7 +2641,7 @@ public class ModItems {
|
||||
billet_pb209 = new Item().setUnlocalizedName("billet_pb209").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":billet_pb209");
|
||||
billet_ra226 = new Item().setUnlocalizedName("billet_ra226").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":billet_ra226");
|
||||
billet_actinium = new Item().setUnlocalizedName("billet_actinium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":billet_actinium");
|
||||
billet_schrabidium = new Item().setUnlocalizedName("billet_schrabidium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":billet_schrabidium");
|
||||
billet_schrabidium = new ItemCustomLore().setRarity(EnumRarity.rare).setUnlocalizedName("billet_schrabidium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":billet_schrabidium");
|
||||
billet_solinium = new Item().setUnlocalizedName("billet_solinium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":billet_solinium");
|
||||
billet_gh336 = new ItemCustomLore().setRarity(EnumRarity.epic).setUnlocalizedName("billet_gh336").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":billet_gh336");
|
||||
billet_australium = new ItemCustomLore().setRarity(EnumRarity.uncommon).setUnlocalizedName("billet_australium").setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":billet_australium");
|
||||
|
||||
@ -1,43 +1,50 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.recipes.RefineryRecipes;
|
||||
import com.hbm.inventory.recipes.RadiolysisRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemRTGPellet;
|
||||
import com.hbm.items.machine.ItemRTGPelletDepleted;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
import com.hbm.util.RTGUtil;
|
||||
import com.hbm.util.Tuple.Quartet;
|
||||
import com.hbm.util.Tuple.Pair;
|
||||
|
||||
import api.hbm.energy.IEnergyGenerator;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemFood;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import scala.actors.threadpool.Arrays;
|
||||
|
||||
public class TileEntityMachineRadiolysis extends TileEntityMachineBase implements IEnergyGenerator, IFluidAcceptor, IFluidSource, IFluidContainer {
|
||||
//TODO: TileMapping, Render file + resource location, container, gui, gui texture, further recipes
|
||||
|
||||
public long power;
|
||||
public int progress;
|
||||
public static final int maxProgress = 100;
|
||||
public static final int maxPower = 1000000;
|
||||
|
||||
public FluidTank[] tanks;
|
||||
public List<IFluidAcceptor> list1 = new ArrayList();
|
||||
public List<IFluidAcceptor> list2 = new ArrayList();
|
||||
|
||||
private static final int[] slot_io = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 13 };
|
||||
private static final int[] slot_rtg = new int[] { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
|
||||
|
||||
public TileEntityMachineRadiolysis() {
|
||||
super(14); //10 rtg slots, 2 fluid ID slots, 2 irradiation slots
|
||||
super(14); //10 rtg slots, 2 fluid ID slots (io), 2 irradiation slots (io)
|
||||
tanks = new FluidTank[3];
|
||||
tanks[0] = new FluidTank(Fluids.NONE, 8000, 0);
|
||||
tanks[1] = new FluidTank(Fluids.NONE, 8000, 1);
|
||||
tanks[2] = new FluidTank(Fluids.NONE, 8000, 2);
|
||||
tanks[0] = new FluidTank(Fluids.NONE, 2000, 0);
|
||||
tanks[1] = new FluidTank(Fluids.NONE, 2000, 1);
|
||||
tanks[2] = new FluidTank(Fluids.NONE, 2000, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -45,7 +52,7 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
return "container.radiolysis";
|
||||
}
|
||||
|
||||
//IO Methods
|
||||
/* IO Methods */
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return i == 12 || (i < 10 && itemStack.getItem() instanceof ItemRTGPellet);
|
||||
@ -61,13 +68,12 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
return (i < 10 && itemStack.getItem() instanceof ItemRTGPelletDepleted) || i == 13;
|
||||
}
|
||||
|
||||
//NBT Methods
|
||||
/* NBT Methods */
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
|
||||
this.power = nbt.getLong("power");
|
||||
this.progress = nbt.getInteger("progress");
|
||||
|
||||
tanks[0].readFromNBT(nbt, "input");
|
||||
tanks[1].readFromNBT(nbt, "output1");
|
||||
@ -79,7 +85,6 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
super.writeToNBT(nbt);
|
||||
|
||||
nbt.setLong("power", power);
|
||||
nbt.setInteger("progress", progress);
|
||||
|
||||
tanks[0].writeToNBT(nbt, "input");
|
||||
tanks[1].writeToNBT(nbt, "output1");
|
||||
@ -88,7 +93,6 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
|
||||
public void networkUnpack(NBTTagCompound data) {
|
||||
this.power = data.getLong("power");
|
||||
this.progress = data.getInteger("progress");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -101,41 +105,33 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
if(power > maxPower)
|
||||
power = maxPower;
|
||||
|
||||
tanks[0].setType(10, 11, slots);
|
||||
setupTanks();
|
||||
tanks[0].updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||
|
||||
if(heat > 0) {
|
||||
progress += heat;
|
||||
if(progress >= maxProgress) {
|
||||
if(heat >= 100 && worldObj.getTotalWorldTime() % 40 == 0)
|
||||
crack();
|
||||
progress = 0;
|
||||
}
|
||||
} else {
|
||||
progress = 0;
|
||||
|
||||
if(heat >= 200 && worldObj.getTotalWorldTime() % 100 == 0)
|
||||
sterilize();
|
||||
}
|
||||
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setLong("power", power);
|
||||
data.setInteger("progress", progress);
|
||||
this.networkPack(data, 50);
|
||||
}
|
||||
}
|
||||
|
||||
//Processing Methods
|
||||
private boolean canDoRadiolysis() {
|
||||
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Processing Methods */
|
||||
private void crack() {
|
||||
|
||||
Quartet<FluidType, FluidType, Integer, Integer> quart = RefineryRecipes.getCracking(tanks[0].getTankType());
|
||||
Pair<FluidStack, FluidStack> quart = RadiolysisRecipes.getRadiolysis(tanks[0].getTankType());
|
||||
|
||||
if(quart != null) {
|
||||
|
||||
int left = quart.getY();
|
||||
int right = quart.getZ();
|
||||
int left = quart.getKey().fill;
|
||||
int right = quart.getValue().fill;
|
||||
|
||||
if(tanks[0].getFill() >= 100 && hasSpace(left, right)) {
|
||||
tanks[0].setFill(tanks[0].getFill() - 100);
|
||||
@ -151,11 +147,11 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
|
||||
private void setupTanks() {
|
||||
|
||||
Quartet<FluidType, FluidType, Integer, Integer> quart = RefineryRecipes.getCracking(tanks[0].getTankType());
|
||||
Pair<FluidStack, FluidStack> quart = RadiolysisRecipes.getRadiolysis(tanks[0].getTankType());
|
||||
|
||||
if(quart != null) {
|
||||
tanks[1].setTankType(quart.getW());
|
||||
tanks[2].setTankType(quart.getX());
|
||||
tanks[1].setTankType(quart.getKey().type);
|
||||
tanks[2].setTankType(quart.getValue().type);
|
||||
} else {
|
||||
tanks[0].setTankType(Fluids.NONE);
|
||||
tanks[1].setTankType(Fluids.NONE);
|
||||
@ -164,7 +160,47 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
|
||||
}
|
||||
|
||||
//Power methods
|
||||
// Code: pressure, sword, sterilize.
|
||||
private void sterilize() {
|
||||
if(!checkIfValid())
|
||||
return;
|
||||
|
||||
if(slots[12].getItem() instanceof ItemFood && !(slots[12].getItem() == ModItems.pancake)) {
|
||||
slots[12].stackSize -= 1;
|
||||
if(slots[12].stackSize <= 0)
|
||||
slots[12] = null;
|
||||
}
|
||||
|
||||
ItemStack output = slots[12].copy();
|
||||
output.stackSize = 1;
|
||||
|
||||
if(slots[13] == null) {
|
||||
slots[13] = output;
|
||||
slots[13].stackTagCompound.setBoolean("ntmContagion", false);
|
||||
} else if(slots[13].isItemEqual(output) && slots[13].stackSize + output.stackSize <= slots[13].getMaxStackSize()) {
|
||||
slots[12].stackSize -= output.stackSize;
|
||||
if(slots[12].stackSize <= 0)
|
||||
slots[12] = null;
|
||||
|
||||
slots[13].stackSize += output.stackSize;
|
||||
slots[13].stackTagCompound.setBoolean("ntmContagion", false);
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkIfValid() {
|
||||
if(slots[12] == null)
|
||||
return false;
|
||||
|
||||
if(!slots[12].hasTagCompound())
|
||||
return false;
|
||||
|
||||
if(!slots[12].getTagCompound().getBoolean("ntmContagion"))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Power methods */
|
||||
@Override
|
||||
public void setPower(long power) {
|
||||
this.power = power;
|
||||
@ -180,7 +216,7 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
return maxPower;
|
||||
}
|
||||
|
||||
//Fluid Methods
|
||||
/* Fluid Methods */
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
if(index < 3 && tanks[index] != null)
|
||||
@ -226,14 +262,15 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
fillFluid(xCoord + 1, yCoord, zCoord, this.getTact(), type);
|
||||
fillFluid(xCoord - 1, yCoord, zCoord, this.getTact(), type);
|
||||
fillFluid(xCoord, yCoord, zCoord + 1, this.getTact(), type);
|
||||
fillFluid(xCoord, yCoord, zCoord - 1, this.getTact(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -243,13 +280,18 @@ public class TileEntityMachineRadiolysis extends TileEntityMachineBase implement
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
if(type == tanks[1].getTankType())
|
||||
return list1;
|
||||
if(type == tanks[2].getTankType())
|
||||
return list2;
|
||||
return new ArrayList<IFluidAcceptor>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList(FluidType type) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
if(type == tanks[1].getTankType())
|
||||
list1.clear();
|
||||
if(type == tanks[2].getTankType())
|
||||
list2.clear();
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user