mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
guh
This commit is contained in:
parent
86ddc7984c
commit
34aee69957
@ -7,6 +7,7 @@ import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemFluidIcon;
|
||||
@ -16,63 +17,47 @@ import net.minecraft.item.ItemStack;
|
||||
|
||||
public class GasCentrifugeRecipes {
|
||||
|
||||
public static enum PseudoFluidType {
|
||||
NONE (0, 0, null, false, (ItemStack[])null),
|
||||
public static class PseudoFluidType {
|
||||
|
||||
HEUF6 (300, 0, NONE, true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1)),
|
||||
MEUF6 (200, 100, HEUF6, false, new ItemStack(ModItems.nugget_u238, 1)),
|
||||
LEUF6 (300, 200, MEUF6, false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1)),
|
||||
NUF6 (400, 300, LEUF6, false, new ItemStack(ModItems.nugget_u238, 1)),
|
||||
public static HashMap<String, PseudoFluidType> types = new HashMap();
|
||||
|
||||
PF6 (300, 0, NONE, false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1)),
|
||||
public static PseudoFluidType NONE = new PseudoFluidType("NONE", 0, 0, null, false, (ItemStack[])null);
|
||||
|
||||
MUD_HEAVY (500, 0, NONE, false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1)),
|
||||
MUD (1000, 500, MUD_HEAVY, false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1));
|
||||
public static PseudoFluidType HEUF6 = new PseudoFluidType("HEUF6", 300, 0, NONE, true, new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 1));
|
||||
public static PseudoFluidType MEUF6 = new PseudoFluidType("MEUF6", 200, 100, HEUF6, false, new ItemStack(ModItems.nugget_u238, 1));
|
||||
public static PseudoFluidType LEUF6 = new PseudoFluidType("LEUF6", 300, 200, MEUF6, false, new ItemStack(ModItems.nugget_u238, 1), new ItemStack(ModItems.fluorite, 1));
|
||||
public static PseudoFluidType NUF6 = new PseudoFluidType("NUF6", 400, 300, LEUF6, false, new ItemStack(ModItems.nugget_u238, 1));
|
||||
|
||||
//TODO for bob: consider more fluid types
|
||||
//Schraranium Trisulfide for more schrab-containing, pre-SILEX processing using the crystals?
|
||||
//Gaseous Nuclear Waste: because why not? Large inputs could output Xe-135 and maybe some other fun stuff...
|
||||
//
|
||||
public static PseudoFluidType PF6 = new PseudoFluidType("PF6", 300, 0, NONE, false, new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2), new ItemStack(ModItems.fluorite, 1));
|
||||
|
||||
public static PseudoFluidType MUD_HEAVY = new PseudoFluidType("MUD_HEAVY", 500, 0, NONE, false, new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.dust, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1));
|
||||
public static PseudoFluidType MUD = new PseudoFluidType("MUD", 1000, 500, MUD_HEAVY, false, new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.dust, 1));
|
||||
|
||||
public String name;
|
||||
int fluidConsumed;
|
||||
int fluidProduced;
|
||||
PseudoFluidType outputFluid;
|
||||
boolean isHighSpeed;
|
||||
ItemStack[] output;
|
||||
|
||||
PseudoFluidType(int fluidConsumed, int fluidProduced, PseudoFluidType outputFluid, boolean isHighSpeed, ItemStack... output) {
|
||||
PseudoFluidType(String name, int fluidConsumed, int fluidProduced, PseudoFluidType outputFluid, boolean isHighSpeed, ItemStack... output) {
|
||||
this.name = name;
|
||||
this.fluidConsumed = fluidConsumed;
|
||||
this.fluidProduced = fluidProduced;
|
||||
this.outputFluid = outputFluid;
|
||||
this.isHighSpeed = isHighSpeed;
|
||||
this.output = output;
|
||||
types.put(name, this);
|
||||
}
|
||||
|
||||
public int getFluidConsumed() {
|
||||
return this.fluidConsumed;
|
||||
}
|
||||
public int getFluidConsumed() { return this.fluidConsumed; }
|
||||
public int getFluidProduced() { return this.fluidProduced; }
|
||||
public PseudoFluidType getOutputType() { return this.outputFluid; }
|
||||
public ItemStack[] getOutput() { return this.output; }
|
||||
public boolean getIfHighSpeed() { return this.isHighSpeed; }
|
||||
public String getName() { return I18nUtil.resolveKey("hbmpseudofluid.".concat(this.name.toLowerCase(Locale.US))); }
|
||||
|
||||
public int getFluidProduced() {
|
||||
return this.fluidProduced;
|
||||
}
|
||||
|
||||
public PseudoFluidType getOutputType() {
|
||||
return this.outputFluid;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return I18nUtil.resolveKey("hbmpseudofluid.".concat(this.toString().toLowerCase(Locale.US)));
|
||||
}
|
||||
|
||||
public boolean getIfHighSpeed() {
|
||||
return this.isHighSpeed;
|
||||
}
|
||||
|
||||
public ItemStack[] getOutput() {
|
||||
return this.output;
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
/* Recipe NEI Handler */
|
||||
//Fluid input; ItemStack[] outputs, isHighSpeed, # of centrifuges
|
||||
@ -102,14 +87,17 @@ public class GasCentrifugeRecipes {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
public static HashMap<FluidType, PseudoFluidType> fluidConversions = new HashMap();
|
||||
|
||||
public static void register() {
|
||||
gasCent.put(new FluidStack(1200, Fluids.UF6), new Object[] { new ItemStack[]
|
||||
{new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)}, true, 4 });
|
||||
gasCent.put(new FluidStack(1200, Fluids.UF6), new Object[] { new ItemStack[]
|
||||
{new ItemStack(ModItems.nugget_u238, 6), new ItemStack(ModItems.nugget_uranium_fuel, 6), new ItemStack(ModItems.fluorite, 4)}, false, 2 });
|
||||
gasCent.put(new FluidStack(900, Fluids.PUF6), new Object[] { new ItemStack[]
|
||||
{new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)}, false, 1 });
|
||||
gasCent.put(new FluidStack(1000, Fluids.WATZ), new Object[] { new ItemStack[]
|
||||
{new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1), new ItemStack(ModItems.dust, 2)}, false, 2 });
|
||||
|
||||
fluidConversions.put(Fluids.UF6, PseudoFluidType.NUF6);
|
||||
fluidConversions.put(Fluids.PUF6, PseudoFluidType.PF6);
|
||||
fluidConversions.put(Fluids.WATZ, PseudoFluidType.MUD);
|
||||
|
||||
gasCent.put(new FluidStack(1200, Fluids.UF6), new Object[] { new ItemStack[] {new ItemStack(ModItems.nugget_u238, 11), new ItemStack(ModItems.nugget_u235, 1), new ItemStack(ModItems.fluorite, 4)}, true, 4 });
|
||||
gasCent.put(new FluidStack(1200, Fluids.UF6), new Object[] { new ItemStack[] {new ItemStack(ModItems.nugget_u238, 6), new ItemStack(ModItems.nugget_uranium_fuel, 6), new ItemStack(ModItems.fluorite, 4)}, false, 2 });
|
||||
gasCent.put(new FluidStack(900, Fluids.PUF6), new Object[] { new ItemStack[] {new ItemStack(ModItems.nugget_pu238, 3), new ItemStack(ModItems.nugget_pu_mix, 6), new ItemStack(ModItems.fluorite, 3)}, false, 1 });
|
||||
gasCent.put(new FluidStack(1000, Fluids.WATZ), new Object[] { new ItemStack[] {new ItemStack(ModItems.powder_iron, 1), new ItemStack(ModItems.powder_lead, 1), new ItemStack(ModItems.nuclear_waste_tiny, 1), new ItemStack(ModItems.dust, 2)}, false, 2 });
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,14 +1,12 @@
|
||||
package com.hbm.tileentity.machine;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.inventory.container.ContainerMachineGasCent;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineGasCent;
|
||||
import com.hbm.inventory.recipes.GasCentrifugeRecipes;
|
||||
import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.IItemFluidIdentifier;
|
||||
@ -36,7 +34,7 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
//epic!
|
||||
public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidAcceptor, IFluidStandardReceiver, IGUIProvider {
|
||||
public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidStandardReceiver, IGUIProvider {
|
||||
|
||||
public long power;
|
||||
public int progress;
|
||||
@ -50,17 +48,9 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
|
||||
private static final int[] slots_io = new int[] { 0, 1, 2, 3 };
|
||||
|
||||
private static HashMap<FluidType, PseudoFluidType> fluidConversions = new HashMap();
|
||||
|
||||
static {
|
||||
fluidConversions.put(Fluids.UF6, PseudoFluidType.NUF6);
|
||||
fluidConversions.put(Fluids.PUF6, PseudoFluidType.PF6);
|
||||
fluidConversions.put(Fluids.WATZ, PseudoFluidType.MUD);
|
||||
}
|
||||
|
||||
public TileEntityMachineGasCent() {
|
||||
super(7);
|
||||
tank = new FluidTank(Fluids.UF6, 2000, 0);
|
||||
tank = new FluidTank(Fluids.UF6, 2000);
|
||||
inputTank = new PseudoFluidTank(PseudoFluidType.NUF6, 8000);
|
||||
outputTank = new PseudoFluidTank(PseudoFluidType.LEUF6, 8000);
|
||||
}
|
||||
@ -180,10 +170,11 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
this.power = data.getLong("power");
|
||||
this.progress = data.getInteger("progress");
|
||||
this.isProgressing = data.getBoolean("isProgressing");
|
||||
this.inputTank.setTankType(PseudoFluidType.valueOf(data.getString("inputType")));
|
||||
this.outputTank.setTankType(PseudoFluidType.valueOf(data.getString("outputType")));
|
||||
this.inputTank.setTankType(PseudoFluidType.types.get(data.getString("inputType")));
|
||||
this.outputTank.setTankType(PseudoFluidType.types.get(data.getString("outputType")));
|
||||
this.inputTank.setFill(data.getInteger("inputFill"));
|
||||
this.outputTank.setFill(data.getInteger("outputFill"));
|
||||
this.tank.readFromNBT(data, "t");
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -195,9 +186,8 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 4, power, maxPower);
|
||||
setTankType(5);
|
||||
tank.updateTank(this);
|
||||
|
||||
if(fluidConversions.containsValue(inputTank.getTankType())) {
|
||||
if(GasCentrifugeRecipes.fluidConversions.containsValue(inputTank.getTankType())) {
|
||||
attemptConversion();
|
||||
}
|
||||
|
||||
@ -246,8 +236,9 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
data.setBoolean("isProgressing", isProgressing);
|
||||
data.setInteger("inputFill", inputTank.getFill());
|
||||
data.setInteger("outputFill", outputTank.getFill());
|
||||
data.setString("inputType", inputTank.getTankType().toString());
|
||||
data.setString("outputType", outputTank.getTankType().toString());
|
||||
data.setString("inputType", inputTank.getTankType().name);
|
||||
data.setString("outputType", outputTank.getTankType().name);
|
||||
tank.writeToNBT(data, "t");
|
||||
this.networkPack(data, 50);
|
||||
|
||||
PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||
@ -258,7 +249,7 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
for(DirPos pos : getConPos()) {
|
||||
this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
|
||||
if(fluidConversions.containsValue(inputTank.getTankType())) {
|
||||
if(GasCentrifugeRecipes.fluidConversions.containsValue(inputTank.getTankType())) {
|
||||
this.trySubscribe(tank.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||
}
|
||||
}
|
||||
@ -301,10 +292,10 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
|
||||
if(slots[in] != null && slots[in].getItem() instanceof IItemFluidIdentifier) {
|
||||
IItemFluidIdentifier id = (IItemFluidIdentifier) slots[in].getItem();
|
||||
FluidType newType = id.getType(null, 0, 0, 0, slots[in]);
|
||||
FluidType newType = id.getType(worldObj, xCoord, yCoord, zCoord, slots[in]);
|
||||
|
||||
if(tank.getTankType() != newType) {
|
||||
PseudoFluidType pseudo = fluidConversions.get(newType);
|
||||
PseudoFluidType pseudo = GasCentrifugeRecipes.fluidConversions.get(newType);
|
||||
|
||||
if(pseudo != null) {
|
||||
inputTank.setTankType(pseudo);
|
||||
@ -316,32 +307,6 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTypeForSync(FluidType type, int index) {
|
||||
tank.setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillForSync(int fill, int index) {
|
||||
tank.setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int fill, FluidType type) {
|
||||
if(type == tank.getTankType())
|
||||
tank.setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
return tank.getTankType() == type ? tank.getFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
return tank.getTankType() == type ? tank.getMaxFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidTank[] getReceivingTanks() {
|
||||
return new FluidTank[] { tank };
|
||||
@ -413,16 +378,16 @@ public class TileEntityMachineGasCent extends TileEntityMachineBase implements I
|
||||
public void writeToNBT(NBTTagCompound nbt, String s) {
|
||||
nbt.setInteger(s, fluid);
|
||||
nbt.setInteger(s + "_max", maxFluid);
|
||||
nbt.setString(s + "_type", type.toString());
|
||||
nbt.setString(s + "_type", type.name);
|
||||
}
|
||||
|
||||
//Called by TE to load fillstate
|
||||
public void readFromNBT(NBTTagCompound nbt, String s) {
|
||||
fluid = nbt.getInteger(s);
|
||||
int max = nbt.getInteger(s + "_max");
|
||||
if(max > 0)
|
||||
maxFluid = nbt.getInteger(s + "_max");
|
||||
type = PseudoFluidType.valueOf(nbt.getString(s + "_type"));
|
||||
if(max > 0) maxFluid = nbt.getInteger(s + "_max");
|
||||
type = PseudoFluidType.types.get(nbt.getString(s + "_type"));
|
||||
if(type == null) type = PseudoFluidType.NONE;
|
||||
}
|
||||
|
||||
/* ______ ______
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 1.5 KiB |
BIN
src/main/resources/assets/hbm/textures/items/radar_link.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/radar_link.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 230 B |
Loading…
x
Reference in New Issue
Block a user