mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
More work on fluid system, fluid storage tank, tank info for chemplant
This commit is contained in:
parent
0626d11da9
commit
a35bf240d4
@ -187,6 +187,10 @@ tile.gas_duct.name=Gasleitung
|
||||
tile.gas_duct_solid.name=Verstärkte Gasleitung
|
||||
tile.machine_drill.name=Automatischer Minenbohrer
|
||||
container.miningDrill=Automatischer Minenbohrer
|
||||
tile.machine_assembler.name=Fertigungsmaschine
|
||||
container.assembler=Fertigungsmaschine
|
||||
tile.machine_chemplant.name=Chemiefabrik
|
||||
container.chemplant=Chemiefabrik
|
||||
|
||||
tile.red_pylon.name=Strommasten
|
||||
item.wiring_red_copper.name=Kabeltrommel
|
||||
@ -1181,6 +1185,7 @@ item.reer_graar.name=The Reer Graar
|
||||
item.letter.name=Eilbrief
|
||||
item.polaroid.name=Das Polaroid
|
||||
item.book_secret.name=3-596-50802-9
|
||||
item.burnt_bark.name=Verbrannte Rinde
|
||||
|
||||
item.crystal_horn.name=Kristallhorn
|
||||
item.crystal_charred.name=Verkohlter Kristall
|
||||
|
||||
@ -187,6 +187,10 @@ tile.gas_duct.name=Gas Pipe
|
||||
tile.gas_duct_solid.name=Coated Gas Pipe
|
||||
tile.machine_drill.name=Automatic Mining Drill
|
||||
container.miningDrill=Automatic Mining Drill
|
||||
tile.machine_assembler.name=Assembly Machine
|
||||
container.assembler=Assembly Machine
|
||||
tile.machine_chemplant.name=Chemical Plant
|
||||
container.chemplant=Chemical Plant
|
||||
|
||||
tile.red_pylon.name=Electricity Pole
|
||||
item.wiring_red_copper.name=Cable Drum
|
||||
@ -1237,6 +1241,7 @@ item.reer_graar.name=The Reer Graar
|
||||
item.letter.name=Express Mail
|
||||
item.polaroid.name=The Polaroid
|
||||
item.book_secret.name=3-596-50802-9
|
||||
item.burnt_bark.name=Burnt Bark
|
||||
|
||||
item.crystal_horn.name=Crystal Horn
|
||||
item.crystal_charred.name=Charred Crystal
|
||||
|
||||
2963
assets/hbm/lang/ns_OC.lang
Normal file
2963
assets/hbm/lang/ns_OC.lang
Normal file
File diff suppressed because it is too large
Load Diff
1262
assets/hbm/lang/te_ST.lang
Normal file
1262
assets/hbm/lang/te_ST.lang
Normal file
File diff suppressed because it is too large
Load Diff
BIN
assets/hbm/textures/gui/fluids.png
Normal file
BIN
assets/hbm/textures/gui/fluids.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 KiB |
BIN
assets/hbm/textures/gui/fluids2.png
Normal file
BIN
assets/hbm/textures/gui/fluids2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 874 B |
Binary file not shown.
|
Before Width: | Height: | Size: 2.9 KiB After Width: | Height: | Size: 2.9 KiB |
BIN
assets/hbm/textures/gui/gui_tank.png
Normal file
BIN
assets/hbm/textures/gui/gui_tank.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.3 KiB |
BIN
assets/hbm/textures/items/burnt_bark.png
Normal file
BIN
assets/hbm/textures/items/burnt_bark.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 370 B |
@ -357,6 +357,9 @@ public class ModBlocks {
|
||||
public static Block machine_chemplant;
|
||||
public static final int guiID_machine_chemplant = 49;
|
||||
|
||||
public static Block machine_fluidtank;
|
||||
public static final int guiID_machine_fluidtank = 50;
|
||||
|
||||
public static Block launch_pad;
|
||||
public static final int guiID_launch_pad = 19;
|
||||
|
||||
@ -672,6 +675,7 @@ public class ModBlocks {
|
||||
drill_pipe = new BlockNoDrop(Material.iron).setBlockName("drill_pipe").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":drill_pipe");
|
||||
machine_assembler = new MachineAssembler(Material.iron).setBlockName("machine_assembler").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":machine_assembler");
|
||||
machine_chemplant = new MachineChemplant(Material.iron).setBlockName("machine_chemplant").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":machine_chemplant");
|
||||
machine_fluidtank = new MachineFluidTank(Material.iron).setBlockName("machine_fluidtank").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock).setBlockTextureName(RefStrings.MODID + ":machine_fluidtank");
|
||||
|
||||
machine_schrabidium_transmutator = new MachineSchrabidiumTransmutator(Material.iron).setBlockName("machine_schrabidium_transmutator").setHardness(5.0F).setResistance(100.0F).setCreativeTab(MainRegistry.tabBlock);
|
||||
|
||||
@ -914,6 +918,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(machine_electric_furnace_on, machine_electric_furnace_on.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_assembler, machine_assembler.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_chemplant, machine_chemplant.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_fluidtank, machine_fluidtank.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_shredder, machine_shredder.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_deuterium, machine_deuterium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(machine_well, machine_well.getUnlocalizedName());
|
||||
|
||||
45
com/hbm/blocks/machine/MachineFluidTank.java
Normal file
45
com/hbm/blocks/machine/MachineFluidTank.java
Normal file
@ -0,0 +1,45 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityDummy;
|
||||
import com.hbm.tileentity.TileEntityMachineFluidTank;
|
||||
import com.hbm.tileentity.TileEntityMachineGasFlare;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineFluidTank extends BlockContainer {
|
||||
|
||||
public MachineFluidTank(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineFluidTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
if(world.isRemote)
|
||||
{
|
||||
return true;
|
||||
} else if(!player.isSneaking())
|
||||
{
|
||||
TileEntityMachineFluidTank entity = (TileEntityMachineFluidTank) world.getTileEntity(x, y, z);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_fluidtank, world, x, y, z);
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
16
com/hbm/calc/UnionOfTileEntitiesAndBooleansForFluids.java
Normal file
16
com/hbm/calc/UnionOfTileEntitiesAndBooleansForFluids.java
Normal file
@ -0,0 +1,16 @@
|
||||
package com.hbm.calc;
|
||||
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.interfaces.IOilSource;
|
||||
|
||||
public class UnionOfTileEntitiesAndBooleansForFluids {
|
||||
|
||||
public UnionOfTileEntitiesAndBooleansForFluids(IFluidSource tileentity, boolean bool)
|
||||
{
|
||||
source = tileentity;
|
||||
ticked = bool;
|
||||
}
|
||||
|
||||
public IFluidSource source;
|
||||
public boolean ticked = false;
|
||||
}
|
||||
@ -3,24 +3,24 @@ package com.hbm.handler;
|
||||
public class FluidTypeHandler {
|
||||
|
||||
public enum FluidType {
|
||||
NONE (0x888888, 8947848, 0, 0, "hbmfluid.none"),
|
||||
WATER (0x3333FF, 3355647, 1, 0, "hbmfluid.water"),
|
||||
COOLANT (0xd8fcff, 14220543, 1, 0, "hbmfluid.coolant"),
|
||||
LAVA (0xFF3300, 16724736, 2, 0, "hbmfluid.lava"),
|
||||
DEUTERIUM (0x0000FF, 255, 1, 1, "hbmfluid.deuterium"),
|
||||
TRITIUM (0x000099, 153, 2, 1, "hbmfluid.tritium"),
|
||||
OIL (0x020202, 131586, 3, 1, "hbmfluid.oil"),
|
||||
SMEAR (0x190f01, 1642241, 0, 2, "hbmfluid.smear"),
|
||||
RECLAIMED (0x332b22, 3353378, 1, 3, "hbmfluid.reclaimed"),
|
||||
PETROIL (0x44413d, 4473149, 2, 3, "hbmfluid.petroil"),
|
||||
LUBRICANT (0x606060, 6316128, 1, 2, "hbmfluid.lubricant"),
|
||||
DIESEL (0xf2eed5, 15920853, 2, 2, "hbmfluid.diesel"),
|
||||
KEROSENE (0xffa5d2, 16754130, 3, 2, "hbmfluid.kerosene"),
|
||||
GAS (0xfffeed, 16776941, 0, 3, "hbmfluid.gas"),
|
||||
UF6 (0xD1CEBE, 13749950, 3, 0, "hbmfluid.uf6"),
|
||||
PUF6 (0x4C4C4C, 5000268, 0, 1, "hbmfluid.puf6"),
|
||||
AMAT (0x010101, 65793, 3, 0, "hbmfluid.amat"),
|
||||
ASCHRAB (0xb50000, 11862016, 0, 1, "hbmfluid.aschrab");
|
||||
NONE (0x888888, 8947848, 0, 1, "hbmfluid.none"),
|
||||
WATER (0x3333FF, 3355647, 1, 1, "hbmfluid.water"),
|
||||
COOLANT (0xd8fcff, 14220543, 2, 1, "hbmfluid.coolant"),
|
||||
LAVA (0xFF3300, 16724736, 3, 1, "hbmfluid.lava"),
|
||||
DEUTERIUM (0x0000FF, 255, 4, 1, "hbmfluid.deuterium"),
|
||||
TRITIUM (0x000099, 153, 5, 1, "hbmfluid.tritium"),
|
||||
OIL (0x020202, 131586, 6, 1, "hbmfluid.oil"),
|
||||
SMEAR (0x190f01, 1642241, 7, 1, "hbmfluid.smear"),
|
||||
RECLAIMED (0x332b22, 3353378, 8, 1, "hbmfluid.reclaimed"),
|
||||
PETROIL (0x44413d, 4473149, 9, 1, "hbmfluid.petroil"),
|
||||
LUBRICANT (0x606060, 6316128, 10, 1, "hbmfluid.lubricant"),
|
||||
DIESEL (0xf2eed5, 15920853, 11, 1, "hbmfluid.diesel"),
|
||||
KEROSENE (0xffa5d2, 16754130, 12, 1, "hbmfluid.kerosene"),
|
||||
GAS (0xfffeed, 16776941, 13, 1, "hbmfluid.gas"),
|
||||
UF6 (0xD1CEBE, 13749950, 14, 1, "hbmfluid.uf6"),
|
||||
PUF6 (0x4C4C4C, 5000268, 15, 1, "hbmfluid.puf6"),
|
||||
AMAT (0x010101, 65793, 0, 2, "hbmfluid.amat"),
|
||||
ASCHRAB (0xb50000, 11862016, 1, 2, "hbmfluid.aschrab");
|
||||
|
||||
private int color;
|
||||
private int msa;
|
||||
|
||||
@ -22,6 +22,7 @@ import com.hbm.inventory.container.ContainerMachineCoal;
|
||||
import com.hbm.inventory.container.ContainerMachineCyclotron;
|
||||
import com.hbm.inventory.container.ContainerMachineDeuterium;
|
||||
import com.hbm.inventory.container.ContainerMachineDiesel;
|
||||
import com.hbm.inventory.container.ContainerMachineFluidTank;
|
||||
import com.hbm.inventory.container.ContainerMachineGasFlare;
|
||||
import com.hbm.inventory.container.ContainerMachineMiningDrill;
|
||||
import com.hbm.inventory.container.ContainerMachineOilWell;
|
||||
@ -66,6 +67,7 @@ import com.hbm.inventory.gui.GUIMachineCyclotron;
|
||||
import com.hbm.inventory.gui.GUIMachineDeuterium;
|
||||
import com.hbm.inventory.gui.GUIMachineDiesel;
|
||||
import com.hbm.inventory.gui.GUIMachineElectricFurnace;
|
||||
import com.hbm.inventory.gui.GUIMachineFluidTank;
|
||||
import com.hbm.inventory.gui.GUIMachineGasFlare;
|
||||
import com.hbm.inventory.gui.GUIMachineGenerator;
|
||||
import com.hbm.inventory.gui.GUIMachineMiningDrill;
|
||||
@ -115,6 +117,7 @@ import com.hbm.tileentity.TileEntityMachineCyclotron;
|
||||
import com.hbm.tileentity.TileEntityMachineDeuterium;
|
||||
import com.hbm.tileentity.TileEntityMachineDiesel;
|
||||
import com.hbm.tileentity.TileEntityMachineElectricFurnace;
|
||||
import com.hbm.tileentity.TileEntityMachineFluidTank;
|
||||
import com.hbm.tileentity.TileEntityMachineGasFlare;
|
||||
import com.hbm.tileentity.TileEntityMachineGenerator;
|
||||
import com.hbm.tileentity.TileEntityMachinePuF6Tank;
|
||||
@ -521,6 +524,14 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new ContainerMachineChemplant(player.inventory, (TileEntityMachineChemplant) entity);
|
||||
}
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_fluidtank:
|
||||
{
|
||||
if(entity instanceof TileEntityMachineFluidTank)
|
||||
{
|
||||
return new ContainerMachineFluidTank(player.inventory, (TileEntityMachineFluidTank) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@ -901,6 +912,14 @@ public class GUIHandler implements IGuiHandler {
|
||||
return new GUIMachineChemplant(player.inventory, (TileEntityMachineChemplant) entity);
|
||||
}
|
||||
}
|
||||
|
||||
case ModBlocks.guiID_machine_fluidtank:
|
||||
{
|
||||
if(entity instanceof TileEntityMachineFluidTank)
|
||||
{
|
||||
return new GUIMachineFluidTank(player.inventory, (TileEntityMachineFluidTank) entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
13
com/hbm/interfaces/IFluidAcceptor.java
Normal file
13
com/hbm/interfaces/IFluidAcceptor.java
Normal file
@ -0,0 +1,13 @@
|
||||
package com.hbm.interfaces;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
|
||||
public interface IFluidAcceptor {
|
||||
|
||||
void setFluidFill(int i, FluidType type);
|
||||
|
||||
int getFluidFill(FluidType type);
|
||||
|
||||
int getMaxFluidFill(FluidType type);
|
||||
|
||||
}
|
||||
19
com/hbm/interfaces/IFluidSource.java
Normal file
19
com/hbm/interfaces/IFluidSource.java
Normal file
@ -0,0 +1,19 @@
|
||||
package com.hbm.interfaces;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
|
||||
public interface IFluidSource {
|
||||
|
||||
void fillFluidInit(FluidType type);
|
||||
|
||||
void fillFluid(int x, int y, int z, boolean newTact, FluidType type);
|
||||
|
||||
boolean getTact();
|
||||
int getFluidFill(FluidType type);
|
||||
void setFluidFill(int i, FluidType type);
|
||||
List<IFluidAcceptor> getFluidList();
|
||||
void clearFluidList();
|
||||
|
||||
}
|
||||
15
com/hbm/inventory/FluidStack.java
Normal file
15
com/hbm/inventory/FluidStack.java
Normal file
@ -0,0 +1,15 @@
|
||||
package com.hbm.inventory;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
|
||||
public class FluidStack {
|
||||
|
||||
public int fill;
|
||||
public FluidType type;
|
||||
|
||||
public FluidStack(int fill, FluidType type) {
|
||||
this.fill = fill;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
}
|
||||
@ -5,6 +5,7 @@ import java.util.Arrays;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.inventory.gui.GuiFluidContainer;
|
||||
import com.hbm.items.tool.ItemFluidIdentifier;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.TEFluidPacket;
|
||||
|
||||
@ -12,15 +13,17 @@ import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class FluidTank {
|
||||
|
||||
FluidType type;
|
||||
int fluid;
|
||||
int maxFluid;
|
||||
public boolean takeIn = true;
|
||||
public boolean letOut = false;
|
||||
public int index;
|
||||
public static ResourceLocation fluidTextures = new ResourceLocation(RefStrings.MODID + ":textures/gui/fluids2.png");
|
||||
public static int x = 16;
|
||||
public static int y = 100;
|
||||
|
||||
public FluidTank(FluidType type, int maxFluid, int index) {
|
||||
this.type = type;
|
||||
@ -33,7 +36,25 @@ public class FluidTank {
|
||||
}
|
||||
|
||||
public void setTankType(FluidType type) {
|
||||
|
||||
if(this.type.name().equals(type.name()))
|
||||
return;
|
||||
|
||||
this.type = type;
|
||||
this.setFill(0);
|
||||
}
|
||||
|
||||
public FluidType getTankType() {
|
||||
|
||||
return type;
|
||||
}
|
||||
|
||||
public int getFill() {
|
||||
return fluid;
|
||||
}
|
||||
|
||||
public int getMaxFill() {
|
||||
return maxFluid;
|
||||
}
|
||||
|
||||
//Called on TE update
|
||||
@ -129,16 +150,12 @@ public class FluidTank {
|
||||
public void writeToNBT(NBTTagCompound nbt, String s) {
|
||||
nbt.setInteger(s, fluid);
|
||||
nbt.setInteger(s + "_type", Arrays.asList(FluidType.values()).indexOf(type));
|
||||
nbt.setBoolean(s + "_in", takeIn);
|
||||
nbt.setBoolean(s + "_out", letOut);
|
||||
}
|
||||
|
||||
//Called by TE to load fillstate
|
||||
public void readFromNBT(NBTTagCompound nbt, String s) {
|
||||
fluid = nbt.getInteger(s);
|
||||
type = FluidType.getEnum(nbt.getInteger(s + "_type"));
|
||||
takeIn = nbt.getBoolean(s + "_in");
|
||||
letOut = nbt.getBoolean(s + "_out");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -5,9 +5,11 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemAssemblyTemplate;
|
||||
import com.hbm.items.tool.ItemAssemblyTemplate.EnumAssemblyTemplate;
|
||||
import com.hbm.items.tool.ItemChemistryTemplate;
|
||||
import com.hbm.main.MainRegistry;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
@ -2495,4 +2497,75 @@ public class MachineRecipes {
|
||||
|
||||
return recipes;
|
||||
}
|
||||
|
||||
public static List<ItemStack> getChemInputFromTempate(ItemStack stack) {
|
||||
|
||||
if(stack == null || !(stack.getItem() instanceof ItemChemistryTemplate))
|
||||
return null;
|
||||
|
||||
List<ItemStack> list = new ArrayList<ItemStack>();
|
||||
|
||||
switch(ItemChemistryTemplate.EnumChemistryTemplate.getEnum(stack.getItemDamage())) {
|
||||
case TEST:
|
||||
list.add(new ItemStack(Items.iron_ingot, 4));
|
||||
list.add(new ItemStack(Items.gold_ingot, 2));
|
||||
list.add(new ItemStack(Items.coal, 8));
|
||||
break;
|
||||
}
|
||||
|
||||
if(list.isEmpty())
|
||||
return null;
|
||||
else
|
||||
return list;
|
||||
}
|
||||
|
||||
public static FluidStack[] getFluidInputFromTempate(ItemStack stack) {
|
||||
|
||||
if(stack == null || !(stack.getItem() instanceof ItemChemistryTemplate))
|
||||
return null;
|
||||
|
||||
FluidStack[] input = new FluidStack[2];
|
||||
|
||||
switch(ItemChemistryTemplate.EnumChemistryTemplate.getEnum(stack.getItemDamage())) {
|
||||
case TEST:
|
||||
input[0] = new FluidStack(400, FluidType.LAVA);
|
||||
input[1] = new FluidStack(200, FluidType.KEROSENE);
|
||||
break;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
|
||||
public static ItemStack[] getChemOutputFromTempate(ItemStack stack) {
|
||||
|
||||
if(stack == null || !(stack.getItem() instanceof ItemChemistryTemplate))
|
||||
return null;
|
||||
|
||||
ItemStack[] output = new ItemStack[4];
|
||||
|
||||
switch(ItemChemistryTemplate.EnumChemistryTemplate.getEnum(stack.getItemDamage())) {
|
||||
case TEST:
|
||||
output[0] = new ItemStack(ModItems.ingot_steel);
|
||||
output[1] = new ItemStack(ModItems.ingot_desh, 2);
|
||||
break;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
public static FluidStack[] getFluidOutputFromTempate(ItemStack stack) {
|
||||
|
||||
if(stack == null || !(stack.getItem() instanceof ItemChemistryTemplate))
|
||||
return null;
|
||||
|
||||
FluidStack[] input = new FluidStack[2];
|
||||
|
||||
switch(ItemChemistryTemplate.EnumChemistryTemplate.getEnum(stack.getItemDamage())) {
|
||||
case TEST:
|
||||
input[0] = new FluidStack(200, FluidType.WATER);
|
||||
break;
|
||||
}
|
||||
|
||||
return input;
|
||||
}
|
||||
}
|
||||
|
||||
89
com/hbm/inventory/container/ContainerMachineFluidTank.java
Normal file
89
com/hbm/inventory/container/ContainerMachineFluidTank.java
Normal file
@ -0,0 +1,89 @@
|
||||
package com.hbm.inventory.container;
|
||||
|
||||
import com.hbm.tileentity.TileEntityMachineBattery;
|
||||
import com.hbm.tileentity.TileEntityMachineFluidTank;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.inventory.Slot;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class ContainerMachineFluidTank extends Container {
|
||||
|
||||
private TileEntityMachineFluidTank diFurnace;
|
||||
private int power;
|
||||
|
||||
public ContainerMachineFluidTank(InventoryPlayer invPlayer, TileEntityMachineFluidTank tedf) {
|
||||
power = 0;
|
||||
|
||||
diFurnace = tedf;
|
||||
|
||||
this.addSlotToContainer(new Slot(tedf, 0, 8, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 1, 8, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 2, 53, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 53, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 4, 125, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 5, 125, 53));
|
||||
this.addSlotToContainer(new Slot(tedf, 6, 152, 17));
|
||||
|
||||
for(int i = 0; i < 3; i++)
|
||||
{
|
||||
for(int j = 0; j < 9; j++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, j + i * 9 + 9, 8 + j * 18, 84 + i * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < 9; i++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(invPlayer, i, 8 + i * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCraftingToCrafters(ICrafting crafting) {
|
||||
super.addCraftingToCrafters(crafting);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot(EntityPlayer p_82846_1_, int par2)
|
||||
{
|
||||
ItemStack var3 = null;
|
||||
Slot var4 = (Slot) this.inventorySlots.get(par2);
|
||||
|
||||
if (var4 != null && var4.getHasStack())
|
||||
{
|
||||
ItemStack var5 = var4.getStack();
|
||||
var3 = var5.copy();
|
||||
|
||||
if (par2 <= 6) {
|
||||
if (!this.mergeItemStack(var5, 7, this.inventorySlots.size(), true))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/*else if (!this.mergeItemStack(var5, 0, 2, false))
|
||||
{
|
||||
return null;
|
||||
}*/
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
var4.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
var4.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
return var3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith(EntityPlayer player) {
|
||||
return diFurnace.isUseableByPlayer(player);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerMachineAssembler;
|
||||
import com.hbm.inventory.container.ContainerMachineChemplant;
|
||||
import com.hbm.lib.RefStrings;
|
||||
@ -14,22 +15,32 @@ import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineChemplant extends GuiContainer {
|
||||
public class GUIMachineChemplant extends GuiFluidContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_chemplant.png");
|
||||
private TileEntityMachineChemplant assembler;
|
||||
private TileEntityMachineChemplant chemplant;
|
||||
|
||||
public GUIMachineChemplant(InventoryPlayer invPlayer, TileEntityMachineChemplant tedf) {
|
||||
super(new ContainerMachineChemplant(invPlayer, tedf));
|
||||
assembler = tedf;
|
||||
chemplant = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 222;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
chemplant.tanks[0].renderTankInfo(this, mouseX, mouseY, guiLeft + 8, guiTop + 52 - 34, 16, 34);
|
||||
chemplant.tanks[1].renderTankInfo(this, mouseX, mouseY, guiLeft + 26, guiTop + 52 - 34, 16, 34);
|
||||
chemplant.tanks[2].renderTankInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 52 - 34, 16, 34);
|
||||
chemplant.tanks[3].renderTankInfo(this, mouseX, mouseY, guiLeft + 152, guiTop + 52 - 34, 16, 34);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer( int i, int j) {
|
||||
String name = this.assembler.hasCustomInventoryName() ? this.assembler.getInventoryName() : I18n.format(this.assembler.getInventoryName());
|
||||
String name = this.chemplant.hasCustomInventoryName() ? this.chemplant.getInventoryName() : I18n.format(this.chemplant.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
@ -40,11 +51,12 @@ public class GUIMachineChemplant extends GuiContainer {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
int i = assembler.getPowerScaled(52);
|
||||
drawTexturedModalRect(guiLeft + 116, guiTop + 70 - i, 176, 52 - i, 16, i);
|
||||
|
||||
int j = assembler.getProgressScaled(83);
|
||||
drawTexturedModalRect(guiLeft + 45, guiTop + 82, 2, 222, j, 32);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(FluidTank.fluidTextures);
|
||||
|
||||
chemplant.tanks[0].renderTank(this, guiLeft + 8, guiTop + 52, chemplant.tanks[0].getTankType().textureX() * FluidTank.x, chemplant.tanks[0].getTankType().textureY() * FluidTank.y, 16, 34);
|
||||
chemplant.tanks[1].renderTank(this, guiLeft + 26, guiTop + 52, chemplant.tanks[1].getTankType().textureX() * FluidTank.x, chemplant.tanks[1].getTankType().textureY() * FluidTank.y, 16, 34);
|
||||
chemplant.tanks[2].renderTank(this, guiLeft + 134, guiTop + 52, chemplant.tanks[2].getTankType().textureX() * FluidTank.x, chemplant.tanks[2].getTankType().textureY() * FluidTank.y, 16, 34);
|
||||
chemplant.tanks[3].renderTank(this, guiLeft + 152, guiTop + 52, chemplant.tanks[3].getTankType().textureX() * FluidTank.x, chemplant.tanks[3].getTankType().textureY() * FluidTank.y, 16, 34);
|
||||
}
|
||||
}
|
||||
|
||||
61
com/hbm/inventory/gui/GUIMachineFluidTank.java
Normal file
61
com/hbm/inventory/gui/GUIMachineFluidTank.java
Normal file
@ -0,0 +1,61 @@
|
||||
package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerElectricFurnace;
|
||||
import com.hbm.inventory.container.ContainerMachineFluidTank;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.TileEntityMachineElectricFurnace;
|
||||
import com.hbm.tileentity.TileEntityMachineFluidTank;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.entity.player.InventoryPlayer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class GUIMachineFluidTank extends GuiFluidContainer {
|
||||
|
||||
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/gui_tank.png");
|
||||
private TileEntityMachineFluidTank tank;
|
||||
|
||||
public GUIMachineFluidTank(InventoryPlayer invPlayer, TileEntityMachineFluidTank tedf) {
|
||||
super(new ContainerMachineFluidTank(invPlayer, tedf));
|
||||
tank = tedf;
|
||||
|
||||
this.xSize = 176;
|
||||
this.ySize = 166;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen(int mouseX, int mouseY, float f) {
|
||||
super.drawScreen(mouseX, mouseY, f);
|
||||
|
||||
tank.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 71, guiTop + 69 - 52, 34, 52);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||
String name = this.tank.hasCustomInventoryName() ? this.tank.getInventoryName() : I18n.format(this.tank.getInventoryName());
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if(tank.dna())
|
||||
drawTexturedModalRect(guiLeft + 152, guiTop + 53, 176, 0, 16, 16);
|
||||
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(FluidTank.fluidTextures);
|
||||
|
||||
tank.tank.renderTank(this, guiLeft + 71, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
tank.tank.renderTank(this, guiLeft + 71 + 16, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
tank.tank.renderTank(this, guiLeft + 71 + 32, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 2, 52);
|
||||
}
|
||||
}
|
||||
@ -2,6 +2,7 @@ package com.hbm.inventory.gui;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.container.ContainerUF6Tank;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.TileEntityMachineUF6Tank;
|
||||
@ -45,6 +46,7 @@ public class GUIMachineUF6Tank extends GuiFluidContainer {
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
tank.tank.renderTank(this, guiLeft + 80, guiTop + 69, 177, 52, 16, 52);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(FluidTank.fluidTextures);
|
||||
tank.tank.renderTank(this, guiLeft + 80, guiTop + 69, tank.tank.getTankType().textureX() * FluidTank.x, tank.tank.getTankType().textureY() * FluidTank.y, 16, 52);
|
||||
}
|
||||
}
|
||||
|
||||
@ -885,6 +885,7 @@ public class ModItems {
|
||||
public static Item polaroid;
|
||||
public static Item letter;
|
||||
public static Item book_secret;
|
||||
public static Item burnt_bark;
|
||||
|
||||
public static Item smoke1;
|
||||
public static Item smoke2;
|
||||
@ -1804,6 +1805,7 @@ public class ModItems {
|
||||
polaroid = new ItemPolaroid().setUnlocalizedName("polaroid").setMaxStackSize(1).setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":polaroid_" + MainRegistry.polaroidID);
|
||||
letter = new ItemStarterKit().setUnlocalizedName("letter").setCreativeTab(MainRegistry.tabNuke).setTextureName(RefStrings.MODID + ":letter");
|
||||
book_secret = new ItemCustomLore().setUnlocalizedName("book_secret").setCreativeTab(MainRegistry.polaroidID == 11 ? MainRegistry.tabNuke : null).setTextureName(RefStrings.MODID + ":book_secret");
|
||||
burnt_bark = new ItemCustomLore().setUnlocalizedName("burnt_bark").setCreativeTab(null).setTextureName(RefStrings.MODID + ":burnt_bark");
|
||||
|
||||
smoke1 = new Item().setUnlocalizedName("smoke1").setTextureName(RefStrings.MODID + ":smoke1");
|
||||
smoke2 = new Item().setUnlocalizedName("smoke2").setTextureName(RefStrings.MODID + ":smoke2");
|
||||
@ -2783,6 +2785,7 @@ public class ModItems {
|
||||
GameRegistry.registerItem(euphemium_stopper, euphemium_stopper.getUnlocalizedName());
|
||||
GameRegistry.registerItem(polaroid, polaroid.getUnlocalizedName());
|
||||
GameRegistry.registerItem(book_secret, book_secret.getUnlocalizedName());
|
||||
GameRegistry.registerItem(burnt_bark, burnt_bark.getUnlocalizedName());
|
||||
|
||||
//Kits
|
||||
GameRegistry.registerItem(nuke_starter_kit, nuke_starter_kit.getUnlocalizedName());
|
||||
|
||||
@ -400,6 +400,11 @@ public class ItemCustomLore extends ItemRadioactive {
|
||||
list.add("High quality silicate, slightly burned.");
|
||||
}
|
||||
|
||||
if(this == ModItems.burnt_bark)
|
||||
{
|
||||
list.add("A piece of bark from an exploded golden oak tree.");
|
||||
}
|
||||
|
||||
if(this == ModItems.crystal_energy)
|
||||
{
|
||||
list.add("Densely packed energy powder.");
|
||||
|
||||
@ -2,9 +2,12 @@ package com.hbm.items.tool;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.MachineRecipes;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
@ -68,27 +71,39 @@ public class ItemChemistryTemplate extends Item {
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool)
|
||||
{
|
||||
|
||||
/*if(!(stack.getItem() instanceof ItemChemistryTemplate))
|
||||
if(!(stack.getItem() instanceof ItemChemistryTemplate))
|
||||
return;
|
||||
|
||||
List<ItemStack> stacks = MachineRecipes.getRecipeFromTempate(stack);
|
||||
ItemStack out = MachineRecipes.getOutputFromTempate(stack);
|
||||
List<ItemStack> stacks = MachineRecipes.getChemInputFromTempate(stack);
|
||||
FluidStack[] inF = MachineRecipes.getFluidInputFromTempate(stack);
|
||||
ItemStack[] out = MachineRecipes.getChemOutputFromTempate(stack);
|
||||
FluidStack[] outF = MachineRecipes.getFluidOutputFromTempate(stack);
|
||||
|
||||
try {
|
||||
list.add("Output:");
|
||||
list.add(out.stackSize + "x " + out.getDisplayName());
|
||||
//try {
|
||||
list.add("Outputs:");
|
||||
for(int i = 0; i < 4; i++)
|
||||
if(out[i] != null)
|
||||
list.add(out[i].stackSize + "x " + out[i].getDisplayName());
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
if(outF[i] != null)
|
||||
list.add(outF[i].fill + "mB " + I18n.format(outF[i].type.getUnlocalizedName()));
|
||||
|
||||
list.add("Inputs:");
|
||||
|
||||
for(int i = 0; i < stacks.size(); i++) {
|
||||
if(stacks.get(i) != null)
|
||||
list.add(stacks.get(i).stackSize + "x " + stacks.get(i).getDisplayName());
|
||||
}
|
||||
|
||||
for(int i = 0; i < stacks.size(); i++)
|
||||
list.add(stacks.get(i).stackSize + "x " + stacks.get(i).getDisplayName());
|
||||
|
||||
for(int i = 0; i < 2; i++)
|
||||
if(inF[i] != null)
|
||||
list.add(inF[i].fill + "mB " + I18n.format(inF[i].type.getUnlocalizedName()));
|
||||
|
||||
list.add("Production time:");
|
||||
list.add(Math.floor((float)(getProcessTime(stack)) / 20 * 100) / 100 + " seconds");
|
||||
} catch(Exception e) {
|
||||
list.add("###INVALID###");
|
||||
list.add("0x334077-0x6A298F-0xDF3795-0x334077");
|
||||
}*/
|
||||
//} catch(Exception e) {
|
||||
// list.add("###INVALID###");
|
||||
// list.add("0x334077-0x6A298F-0xDF3795-0x334077");
|
||||
//}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleans;
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids;
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleansForGas;
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleansForOil;
|
||||
import com.hbm.entity.mob.EntityHunterChopper;
|
||||
@ -11,6 +12,9 @@ import com.hbm.entity.projectile.EntityChopperMine;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConductor;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidDuct;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.interfaces.IGasAcceptor;
|
||||
import com.hbm.interfaces.IGasDuct;
|
||||
import com.hbm.interfaces.IGasSource;
|
||||
@ -27,6 +31,7 @@ import com.hbm.tileentity.TileEntityFluidDuct;
|
||||
import com.hbm.tileentity.TileEntityGasDuct;
|
||||
import com.hbm.tileentity.TileEntityGasDuctSolid;
|
||||
import com.hbm.tileentity.TileEntityMachineBattery;
|
||||
import com.hbm.tileentity.TileEntityMachineFluidTank;
|
||||
import com.hbm.tileentity.TileEntityOilDuct;
|
||||
import com.hbm.tileentity.TileEntityOilDuctSolid;
|
||||
import com.hbm.tileentity.TileEntityPylonRedWire;
|
||||
@ -278,7 +283,8 @@ public class Library {
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_well ||
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_flare ||
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_drill ||
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_assembler)
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_assembler ||
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_chemplant)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
@ -312,7 +318,10 @@ public class Library {
|
||||
public static boolean checkFluidConnectables(World world, int x, int y, int z, FluidType type)
|
||||
{
|
||||
TileEntity tileentity = world.getTileEntity(x, y, z);
|
||||
if((tileentity != null && tileentity instanceof TileEntityFluidDuct))
|
||||
if((tileentity != null && tileentity instanceof TileEntityFluidDuct) ||
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_well ||
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_flare ||
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_chemplant)
|
||||
{
|
||||
if(((TileEntityFluidDuct)tileentity).type == type)
|
||||
return true;
|
||||
@ -359,6 +368,19 @@ public class Library {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkGasUnionListForFluids(List<UnionOfTileEntitiesAndBooleansForFluids> list, IFluidSource that) {
|
||||
|
||||
for(UnionOfTileEntitiesAndBooleansForFluids union : list)
|
||||
{
|
||||
if(union.source == that)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
////// ////// ////// ////// ////// //// ////// ////// //////
|
||||
// // // // // // // // // // //
|
||||
//// ////// ///// // //// //// //// // // // //
|
||||
@ -826,6 +848,11 @@ public class Library {
|
||||
{
|
||||
tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ);
|
||||
}
|
||||
//Chemplant
|
||||
if(block == ModBlocks.dummy_port_chemplant)
|
||||
{
|
||||
tileentity = worldObj.getTileEntity(((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetX, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetY, ((TileEntityDummy)worldObj.getTileEntity(x, y, z)).targetZ);
|
||||
}
|
||||
|
||||
if(tileentity instanceof IConductor)
|
||||
{
|
||||
@ -1128,4 +1155,66 @@ public class Library {
|
||||
that.clearGasList();
|
||||
}
|
||||
}
|
||||
|
||||
public static void transmitFluid(int x, int y, int z, boolean newTact, IFluidSource that, World worldObj, FluidType type) {
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
TileEntity tileentity = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
if(tileentity instanceof IFluidDuct)
|
||||
{
|
||||
if(tileentity instanceof TileEntityFluidDuct && ((TileEntityFluidDuct)tileentity).type.name().equals(type.name()))
|
||||
{
|
||||
if(Library.checkGasUnionListForFluids(((TileEntityFluidDuct)tileentity).uoteab, that))
|
||||
{
|
||||
for(int i = 0; i < ((TileEntityFluidDuct)tileentity).uoteab.size(); i++)
|
||||
{
|
||||
if(((TileEntityFluidDuct)tileentity).uoteab.get(i).source == that)
|
||||
{
|
||||
if(((TileEntityFluidDuct)tileentity).uoteab.get(i).ticked != newTact)
|
||||
{
|
||||
((TileEntityFluidDuct)tileentity).uoteab.get(i).ticked = newTact;
|
||||
that.fillFluid(x, y + 1, z, that.getTact(), type);
|
||||
that.fillFluid(x, y - 1, z, that.getTact(), type);
|
||||
that.fillFluid(x - 1, y, z, that.getTact(), type);
|
||||
that.fillFluid(x + 1, y, z, that.getTact(), type);
|
||||
that.fillFluid(x, y, z - 1, that.getTact(), type);
|
||||
that.fillFluid(x, y, z + 1, that.getTact(), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
((TileEntityFluidDuct)tileentity).uoteab.add(new UnionOfTileEntitiesAndBooleansForFluids(that, newTact));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(tileentity instanceof IFluidAcceptor && newTact && !(tileentity instanceof TileEntityMachineFluidTank && ((TileEntityMachineFluidTank)tileentity).dna()))
|
||||
{
|
||||
that.getFluidList().add((IFluidAcceptor)tileentity);
|
||||
}
|
||||
|
||||
if(!newTact)
|
||||
{
|
||||
int size = that.getFluidList().size();
|
||||
if(size > 0)
|
||||
{
|
||||
int part = that.getFluidFill(type) / size;
|
||||
for(IFluidAcceptor consume : that.getFluidList())
|
||||
{
|
||||
if(consume.getFluidFill(type) < consume.getMaxFluidFill(type))
|
||||
{
|
||||
if(consume.getMaxFluidFill(type) - consume.getFluidFill(type) >= part)
|
||||
{
|
||||
that.setFluidFill(that.getFluidFill(type)-part, type);
|
||||
consume.setFluidFill(consume.getFluidFill(type) + part, type);
|
||||
} else {
|
||||
that.setFluidFill(that.getFluidFill(type) - (consume.getMaxFluidFill(type) - consume.getFluidFill(type)), type);
|
||||
consume.setFluidFill(consume.getMaxFluidFill(type), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
that.clearFluidList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,6 +7,10 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.Item.ToolMaterial;
|
||||
import net.minecraft.item.ItemArmor.ArmorMaterial;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.ForgeChunkManager;
|
||||
import net.minecraftforge.common.ForgeChunkManager.LoadingCallback;
|
||||
import net.minecraftforge.common.ForgeChunkManager.Ticket;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.config.Configuration;
|
||||
import net.minecraftforge.common.config.Property;
|
||||
@ -19,6 +23,7 @@ import cpw.mods.fml.common.Mod.Instance;
|
||||
import cpw.mods.fml.common.Mod.Metadata;
|
||||
import cpw.mods.fml.common.ModMetadata;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
|
||||
@ -64,6 +64,8 @@ public class NEIConfig implements IConfigureNEI {
|
||||
API.hideItem(new ItemStack(ModItems.rod_quad_euphemium));
|
||||
API.hideItem(new ItemStack(ModItems.rod_euphemium));
|
||||
API.hideItem(new ItemStack(ModItems.book_secret));
|
||||
if(MainRegistry.polaroidID != 11)
|
||||
API.hideItem(new ItemStack(ModItems.burnt_bark));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -1,5 +1,10 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleans;
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleansForFluids;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IFluidDuct;
|
||||
import com.hbm.lib.Library;
|
||||
@ -15,6 +20,7 @@ public class TileEntityFluidDuct extends TileEntity implements IFluidDuct {
|
||||
|
||||
public ForgeDirection[] connections = new ForgeDirection[6];
|
||||
public FluidType type = FluidType.NONE;
|
||||
public List<UnionOfTileEntitiesAndBooleansForFluids> uoteab = new ArrayList<UnionOfTileEntitiesAndBooleansForFluids>();
|
||||
|
||||
//public List<UnionOfTileEntitiesAndBooleansForGas> uoteab = new ArrayList<UnionOfTileEntitiesAndBooleansForGas>();
|
||||
|
||||
|
||||
@ -6,11 +6,13 @@ import java.util.Random;
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.MachineRecipes;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.special.ItemBattery;
|
||||
import com.hbm.items.tool.ItemAssemblyTemplate;
|
||||
import com.hbm.items.tool.ItemChemistryTemplate;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.packet.TEAssemblerPacket;
|
||||
@ -58,14 +60,6 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
tanks[1].index = 1;
|
||||
tanks[2].index = 2;
|
||||
tanks[3].index = 3;
|
||||
tanks[0].takeIn = true;
|
||||
tanks[1].takeIn = true;
|
||||
tanks[2].takeIn = false;
|
||||
tanks[3].takeIn = false;
|
||||
tanks[0].letOut = false;
|
||||
tanks[1].letOut = false;
|
||||
tanks[2].letOut = true;
|
||||
tanks[3].letOut = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -235,16 +229,36 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
setContainers();
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
|
||||
tanks[0].loadTank(17, 19, slots);
|
||||
tanks[1].loadTank(18, 20, slots);
|
||||
tanks[2].unloadTank(9, 11, slots);
|
||||
tanks[3].unloadTank(10, 12, slots);
|
||||
|
||||
for(int i = 0; i < 4; i++) {
|
||||
tanks[i].updateTank(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void setContainers() {
|
||||
|
||||
if(slots[4] == null || (slots[4] != null && !(slots[4].getItem() instanceof ItemChemistryTemplate))) {
|
||||
} else {
|
||||
FluidStack[] inputs = MachineRecipes.getFluidInputFromTempate(slots[4]);
|
||||
FluidStack[] outputs = MachineRecipes.getFluidOutputFromTempate(slots[4]);
|
||||
|
||||
tanks[0].setTankType(inputs[0] == null ? FluidType.NONE : inputs[0].type);
|
||||
tanks[1].setTankType(inputs[1] == null ? FluidType.NONE : inputs[1].type);
|
||||
tanks[2].setTankType(outputs[0] == null ? FluidType.NONE : outputs[0].type);
|
||||
tanks[3].setTankType(outputs[1] == null ? FluidType.NONE : outputs[1].type);
|
||||
}
|
||||
}
|
||||
|
||||
//I can't believe that worked.
|
||||
public ItemStack[] cloneItemStackProper(ItemStack[] array) {
|
||||
ItemStack[] stack = new ItemStack[array.length];
|
||||
|
||||
288
com/hbm/tileentity/TileEntityMachineFluidTank.java
Normal file
288
com/hbm/tileentity/TileEntityMachineFluidTank.java
Normal file
@ -0,0 +1,288 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
|
||||
public class TileEntityMachineFluidTank extends TileEntity implements ISidedInventory, IFluidContainer, IFluidSource, IFluidAcceptor {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
//public static final int maxFill = 64 * 3;
|
||||
public FluidTank tank;
|
||||
|
||||
private static final int[] slots_top = new int[] {0};
|
||||
private static final int[] slots_bottom = new int[] {0};
|
||||
private static final int[] slots_side = new int[] {0};
|
||||
public int age = 0;
|
||||
public List<IFluidAcceptor> list = new ArrayList();
|
||||
|
||||
private String customName;
|
||||
|
||||
public TileEntityMachineFluidTank() {
|
||||
slots = new ItemStack[7];
|
||||
tank = new FluidTank(FluidType.NONE, 256000, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory() {
|
||||
return slots.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot(int i) {
|
||||
return slots[i];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing(int i) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents(int i, ItemStack itemStack) {
|
||||
slots[i] = itemStack;
|
||||
if(itemStack != null && itemStack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
itemStack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName() {
|
||||
return this.hasCustomInventoryName() ? this.customName : "container.fluidtank";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName() {
|
||||
return this.customName != null && this.customName.length() > 0;
|
||||
}
|
||||
|
||||
public void setCustomName(String name) {
|
||||
this.customName = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer(EntityPlayer player) {
|
||||
if(worldObj.getTileEntity(xCoord, yCoord, zCoord) != this)
|
||||
{
|
||||
return false;
|
||||
}else{
|
||||
return player.getDistanceSq(xCoord + 0.5D, yCoord + 0.5D, zCoord + 0.5D) <=64;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory() {}
|
||||
@Override
|
||||
public void closeInventory() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack stack) {
|
||||
if(i == 0 && stack.getItem() == ModItems.cell_uf6)
|
||||
return true;
|
||||
if(i == 2 && stack.getItem() == ModItems.cell_empty)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize(int i, int j) {
|
||||
if(slots[i] != null)
|
||||
{
|
||||
if(slots[i].stackSize <= j)
|
||||
{
|
||||
ItemStack itemStack = slots[i];
|
||||
slots[i] = null;
|
||||
return itemStack;
|
||||
}
|
||||
ItemStack itemStack1 = slots[i].splitStack(j);
|
||||
if (slots[i].stackSize == 0)
|
||||
{
|
||||
slots[i] = null;
|
||||
}
|
||||
|
||||
return itemStack1;
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt) {
|
||||
super.readFromNBT(nbt);
|
||||
NBTTagList list = nbt.getTagList("items", 10);
|
||||
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
tank.readFromNBT(nbt, "content");
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
NBTTagCompound nbt1 = list.getCompoundTagAt(i);
|
||||
byte b0 = nbt1.getByte("slot");
|
||||
if(b0 >= 0 && b0 < slots.length)
|
||||
{
|
||||
slots[b0] = ItemStack.loadItemStackFromNBT(nbt1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt) {
|
||||
super.writeToNBT(nbt);
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
tank.writeToNBT(nbt, "content");
|
||||
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
if(slots[i] != null)
|
||||
{
|
||||
NBTTagCompound nbt1 = new NBTTagCompound();
|
||||
nbt1.setByte("slot", (byte)i);
|
||||
slots[i].writeToNBT(nbt1);
|
||||
list.appendTag(nbt1);
|
||||
}
|
||||
}
|
||||
nbt.setTag("items", list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
|
||||
{
|
||||
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInsertItem(int i, ItemStack itemStack, int j) {
|
||||
return this.isItemValidForSlot(i, itemStack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
tank.loadTank(2, 3, slots);
|
||||
tank.setType(0, 1, slots);
|
||||
tank.unloadTank(4, 5, slots);
|
||||
tank.updateTank(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean dna() {
|
||||
if(slots[6] != null && (slots[6].getItem() == ModItems.fuse || slots[6].getItem() == ModItems.screwdriver))
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
return TileEntity.INFINITE_EXTENT_AABB;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public double getMaxRenderDistanceSquared()
|
||||
{
|
||||
return 65536.0D;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFillstate(int fill, int index) {
|
||||
tank.setFill(fill);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setType(FluidType type, int index) {
|
||||
tank.setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
return type.name().equals(this.tank.getTankType().name()) ? tank.getMaxFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
fillFluid(this.xCoord, this.yCoord + 1, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord - 1, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord + 1, getTact(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
|
||||
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getTact() {
|
||||
if (age >= 0 && age < 10) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
return type.name().equals(this.tank.getTankType().name()) ? tank.getFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tank.getTankType().name()))
|
||||
tank.setFill(i);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList() {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList() {
|
||||
this.list.clear();
|
||||
}
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user