mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
Proper fluid tank model, got transmission to work (mostly)
This commit is contained in:
parent
a35bf240d4
commit
bfb447278f
@ -191,6 +191,12 @@ tile.machine_assembler.name=Fertigungsmaschine
|
||||
container.assembler=Fertigungsmaschine
|
||||
tile.machine_chemplant.name=Chemiefabrik
|
||||
container.chemplant=Chemiefabrik
|
||||
tile.fluid_duct.name=Universelles Flüssigkeitsrohr
|
||||
tile.machine_fluidtank.name=Tank
|
||||
container.fluidtank=Tank
|
||||
|
||||
tile.crate_iron.name=Eisenkiste
|
||||
tile.crate_steel.name=Stahlkiste
|
||||
|
||||
tile.red_pylon.name=Strommasten
|
||||
item.wiring_red_copper.name=Kabeltrommel
|
||||
|
||||
@ -191,6 +191,12 @@ tile.machine_assembler.name=Assembly Machine
|
||||
container.assembler=Assembly Machine
|
||||
tile.machine_chemplant.name=Chemical Plant
|
||||
container.chemplant=Chemical Plant
|
||||
tile.fluid_duct.name=Universal Fluid Duct
|
||||
tile.machine_fluidtank.name=Tank
|
||||
container.fluidtank=Tank
|
||||
|
||||
tile.crate_iron.name=Iron Crate
|
||||
tile.crate_steel.name=Steel Crate
|
||||
|
||||
tile.red_pylon.name=Electricity Pole
|
||||
item.wiring_red_copper.name=Cable Drum
|
||||
@ -256,6 +262,8 @@ tile.machine_rtg_cyan.name=Schrabidium Decay Generator (WIP)
|
||||
tile.machine_rtg_blue.name=Convection Generator
|
||||
tile.machine_rtg_purple.name=Antimatter Annihilation Generator
|
||||
|
||||
item.fluid_identifier.name=Fluid Identifier
|
||||
|
||||
item.assembly_template.TEST.name=Assembly Template: Test
|
||||
item.assembly_template.MIXED_PLATE.name=Assembly Template: Mixed Plate
|
||||
item.assembly_template.HAZMAT_CLOTH.name=Assembly Template: Hazmat Cloth
|
||||
|
||||
38
assets/hbm/models/fluidtank_label.obj
Normal file
38
assets/hbm/models/fluidtank_label.obj
Normal file
@ -0,0 +1,38 @@
|
||||
# Blender v2.76 (sub 0) OBJ File: 'fluidtank_label.blend'
|
||||
# www.blender.org
|
||||
o Cube.001_Cube.000
|
||||
v -1.260000 1.750000 0.875000
|
||||
v -1.260000 1.750000 -1.000000
|
||||
v -1.260000 1.750000 1.000000
|
||||
v -1.164849 2.228354 -1.000000
|
||||
v -1.164849 2.228355 1.000000
|
||||
v -1.260000 1.750000 -0.875000
|
||||
v 1.260000 1.750000 0.875000
|
||||
v 1.164849 2.228354 -1.000000
|
||||
v 1.164849 2.228354 1.000000
|
||||
v 1.260000 1.750000 -1.000000
|
||||
v 1.260000 1.750000 1.000000
|
||||
v 1.260000 1.750000 -0.875000
|
||||
vt 0.000697 0.000139
|
||||
vt 0.937966 0.487721
|
||||
vt 0.071437 0.487780
|
||||
vt 0.935055 0.505640
|
||||
vt 0.997387 0.992019
|
||||
vt 0.062467 0.505674
|
||||
vt 0.000139 0.487453
|
||||
vt 0.999693 -0.000208
|
||||
vt 0.999861 0.487717
|
||||
vt 0.000139 0.505676
|
||||
vt 0.000144 0.992057
|
||||
vt 0.997383 0.505637
|
||||
vn -0.980800 0.195100 0.000000
|
||||
vn 0.980800 0.195100 0.000000
|
||||
s off
|
||||
f 5/1/1 6/2/1 1/3/1
|
||||
f 12/4/2 8/5/2 7/6/2
|
||||
f 1/3/1 3/7/1 5/1/1
|
||||
f 5/1/1 4/8/1 6/2/1
|
||||
f 2/9/1 6/2/1 4/8/1
|
||||
f 11/10/2 7/6/2 9/11/2
|
||||
f 12/4/2 10/12/2 8/5/2
|
||||
f 8/5/2 9/11/2 7/6/2
|
||||
1118
assets/hbm/models/fluidtank_main.obj
Normal file
1118
assets/hbm/models/fluidtank_main.obj
Normal file
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 216 B After Width: | Height: | Size: 229 B |
BIN
assets/hbm/textures/blocks/fluid_duct_alt.png
Normal file
BIN
assets/hbm/textures/blocks/fluid_duct_alt.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 186 B |
@ -406,6 +406,8 @@ public class ModBlocks {
|
||||
public static Block dummy_port_assembler;
|
||||
public static Block dummy_block_chemplant;
|
||||
public static Block dummy_port_chemplant;
|
||||
public static Block dummy_block_fluidtank;
|
||||
public static Block dummy_port_fluidtank;
|
||||
|
||||
|
||||
private static void initializeBlock() {
|
||||
@ -719,6 +721,8 @@ public class ModBlocks {
|
||||
dummy_port_assembler = new DummyBlockAssembler(Material.iron).setBlockName("dummy_port_assembler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
dummy_block_chemplant = new DummyBlockChemplant(Material.iron).setBlockName("dummy_block_chemplant").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
dummy_port_chemplant = new DummyBlockChemplant(Material.iron).setBlockName("dummy_port_chemplant").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
dummy_block_fluidtank = new DummyBlockFluidTank(Material.iron).setBlockName("dummy_block_fluidtank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
dummy_port_fluidtank = new DummyBlockFluidTank(Material.iron).setBlockName("dummy_port_fluidtank").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
|
||||
}
|
||||
|
||||
private static void registerBlock() {
|
||||
@ -1017,6 +1021,8 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(dummy_port_assembler, dummy_port_assembler.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dummy_block_chemplant, dummy_block_chemplant.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dummy_port_chemplant, dummy_port_chemplant.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dummy_block_fluidtank, dummy_block_fluidtank.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(dummy_port_fluidtank, dummy_port_fluidtank.getUnlocalizedName());
|
||||
|
||||
//Other Technical Blocks
|
||||
GameRegistry.registerBlock(oil_pipe, oil_pipe.getUnlocalizedName());
|
||||
|
||||
106
com/hbm/blocks/machine/DummyBlockFluidTank.java
Normal file
106
com/hbm/blocks/machine/DummyBlockFluidTank.java
Normal file
@ -0,0 +1,106 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.interfaces.IDummy;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityDummy;
|
||||
import com.hbm.tileentity.TileEntityMachineCyclotron;
|
||||
import com.hbm.tileentity.TileEntityMachineFluidTank;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DummyBlockFluidTank extends BlockContainer implements IDummy {
|
||||
|
||||
public static boolean safeBreak = false;
|
||||
|
||||
public DummyBlockFluidTank(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityDummy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void breakBlock(World world, int x, int y, int z, Block block, int i)
|
||||
{
|
||||
if(!safeBreak) {
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te != null && te instanceof TileEntityDummy) {
|
||||
int a = ((TileEntityDummy)te).targetX;
|
||||
int b = ((TileEntityDummy)te).targetY;
|
||||
int c = ((TileEntityDummy)te).targetZ;
|
||||
|
||||
//world.getBlock(a, b, c).breakBlock(world, a, b, c, block, i);
|
||||
if(!world.isRemote)
|
||||
world.func_147480_a(a, b, c, true);
|
||||
}
|
||||
}
|
||||
world.removeTileEntity(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Item getItem(World world, int x, int y, int z)
|
||||
{
|
||||
return Item.getItemFromBlock(ModBlocks.machine_fluidtank);
|
||||
}
|
||||
|
||||
@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())
|
||||
{
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
if(te != null && te instanceof TileEntityDummy) {
|
||||
int a = ((TileEntityDummy)te).targetX;
|
||||
int b = ((TileEntityDummy)te).targetY;
|
||||
int c = ((TileEntityDummy)te).targetZ;
|
||||
|
||||
TileEntityMachineFluidTank entity = (TileEntityMachineFluidTank) world.getTileEntity(a, b, c);
|
||||
if(entity != null)
|
||||
{
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_machine_fluidtank, world, a, b, c);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,10 @@
|
||||
package com.hbm.blocks.machine;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.handler.MultiblockHandler;
|
||||
import com.hbm.interfaces.IMultiblock;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityDummy;
|
||||
import com.hbm.tileentity.TileEntityMachineFluidTank;
|
||||
@ -9,11 +13,15 @@ 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.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class MachineFluidTank extends BlockContainer {
|
||||
public class MachineFluidTank extends BlockContainer implements IMultiblock {
|
||||
|
||||
public MachineFluidTank(Material p_i45386_1_) {
|
||||
super(p_i45386_1_);
|
||||
@ -23,6 +31,26 @@ public class MachineFluidTank extends BlockContainer {
|
||||
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
|
||||
return new TileEntityMachineFluidTank();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(ModBlocks.machine_fluidtank);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
|
||||
@ -42,4 +70,190 @@ public class MachineFluidTank extends BlockContainer {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase player, ItemStack itemStack) {
|
||||
int i = MathHelper.floor_double(player.rotationYaw * 4.0F / 360.0F + 0.5D) & 3;
|
||||
|
||||
if (i == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
|
||||
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.fluidTankDimensionEW)) {
|
||||
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.fluidTankDimensionEW, ModBlocks.dummy_block_fluidtank);
|
||||
|
||||
//
|
||||
DummyBlockFluidTank.safeBreak = true;
|
||||
world.setBlock(x + 1, y, z + 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te = world.getTileEntity(x + 1, y, z + 1);
|
||||
if(te instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x + 1, y, z - 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te1 = world.getTileEntity(x + 1, y, z - 1);
|
||||
if(te1 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te1;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 1, y, z + 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te2 = world.getTileEntity(x - 1, y, z + 1);
|
||||
if(te2 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te2;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 1, y, z - 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te3 = world.getTileEntity(x - 1, y, z - 1);
|
||||
if(te3 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te3;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
DummyBlockFluidTank.safeBreak = false;
|
||||
//
|
||||
|
||||
} else
|
||||
world.func_147480_a(x, y, z, true);
|
||||
}
|
||||
if (i == 1) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
|
||||
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.fluidTankDimensionNS)) {
|
||||
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.fluidTankDimensionNS, ModBlocks.dummy_block_fluidtank);
|
||||
|
||||
//
|
||||
DummyBlockFluidTank.safeBreak = true;
|
||||
world.setBlock(x + 1, y, z + 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te = world.getTileEntity(x + 1, y, z + 1);
|
||||
if(te instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x + 1, y, z - 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te1 = world.getTileEntity(x + 1, y, z - 1);
|
||||
if(te1 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te1;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 1, y, z + 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te2 = world.getTileEntity(x - 1, y, z + 1);
|
||||
if(te2 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te2;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 1, y, z - 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te3 = world.getTileEntity(x - 1, y, z - 1);
|
||||
if(te3 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te3;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
DummyBlockFluidTank.safeBreak = false;
|
||||
//
|
||||
|
||||
} else
|
||||
world.func_147480_a(x, y, z, true);
|
||||
}
|
||||
if (i == 2) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
|
||||
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.fluidTankDimensionEW)) {
|
||||
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.fluidTankDimensionEW, ModBlocks.dummy_block_fluidtank);
|
||||
|
||||
//
|
||||
DummyBlockFluidTank.safeBreak = true;
|
||||
world.setBlock(x + 1, y, z + 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te = world.getTileEntity(x + 1, y, z + 1);
|
||||
if(te instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x + 1, y, z - 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te1 = world.getTileEntity(x + 1, y, z - 1);
|
||||
if(te1 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te1;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 1, y, z + 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te2 = world.getTileEntity(x - 1, y, z + 1);
|
||||
if(te2 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te2;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 1, y, z - 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te3 = world.getTileEntity(x - 1, y, z - 1);
|
||||
if(te3 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te3;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
DummyBlockFluidTank.safeBreak = false;
|
||||
//
|
||||
|
||||
} else
|
||||
world.func_147480_a(x, y, z, true);
|
||||
}
|
||||
if (i == 3) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, 2, 2);
|
||||
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.fluidTankDimensionNS)) {
|
||||
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.fluidTankDimensionNS, ModBlocks.dummy_block_fluidtank);
|
||||
|
||||
//
|
||||
DummyBlockFluidTank.safeBreak = true;
|
||||
world.setBlock(x + 1, y, z + 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te = world.getTileEntity(x + 1, y, z + 1);
|
||||
if(te instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x + 1, y, z - 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te1 = world.getTileEntity(x + 1, y, z - 1);
|
||||
if(te1 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te1;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 1, y, z + 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te2 = world.getTileEntity(x - 1, y, z + 1);
|
||||
if(te2 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te2;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
world.setBlock(x - 1, y, z - 1, ModBlocks.dummy_port_fluidtank);
|
||||
TileEntity te3 = world.getTileEntity(x - 1, y, z - 1);
|
||||
if(te3 instanceof TileEntityDummy) {
|
||||
TileEntityDummy dummy = (TileEntityDummy)te3;
|
||||
dummy.targetX = x;
|
||||
dummy.targetY = y;
|
||||
dummy.targetZ = z;
|
||||
}
|
||||
DummyBlockFluidTank.safeBreak = false;
|
||||
//
|
||||
|
||||
} else
|
||||
world.func_147480_a(x, y, z, true);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -56,6 +56,8 @@ public class MultiblockHandler {
|
||||
public static final int[] chemplantDimensionEast = new int[] { 2, 1, 2, 0, 2, 1 };
|
||||
public static final int[] chemplantDimensionSouth = new int[] { 1, 2, 2, 0, 2, 1 };
|
||||
public static final int[] chemplantDimensionWest = new int[] { 1, 2, 2, 0, 1, 2 };
|
||||
public static final int[] fluidTankDimensionNS = new int[] { 1, 1, 2, 0, 2, 2 };
|
||||
public static final int[] fluidTankDimensionEW = new int[] { 2, 2, 2, 0, 1, 1 };
|
||||
|
||||
//Approved!
|
||||
public static boolean checkSpace(World world, int x, int y, int z, int[] i) {
|
||||
|
||||
@ -4,10 +4,10 @@ import com.hbm.handler.FluidTypeHandler.FluidType;
|
||||
|
||||
public interface IFluidAcceptor {
|
||||
|
||||
void setFluidFill(int i, FluidType type);
|
||||
void setAFluidFill(int i, FluidType type);
|
||||
|
||||
int getFluidFill(FluidType type);
|
||||
int getAFluidFill(FluidType type);
|
||||
|
||||
int getMaxFluidFill(FluidType type);
|
||||
int getMaxAFluidFill(FluidType type);
|
||||
|
||||
}
|
||||
|
||||
@ -11,9 +11,9 @@ public interface IFluidSource {
|
||||
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();
|
||||
int getSFluidFill(FluidType type);
|
||||
void setSFluidFill(int i, FluidType type);
|
||||
List<IFluidAcceptor> getFluidList(FluidType type);
|
||||
void clearFluidList(FluidType type);
|
||||
|
||||
}
|
||||
|
||||
@ -22,8 +22,8 @@ public class ContainerMachineFluidTank extends Container {
|
||||
|
||||
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, 2, 53 - 18, 17));
|
||||
this.addSlotToContainer(new Slot(tedf, 3, 53 - 18, 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));
|
||||
@ -64,10 +64,10 @@ public class ContainerMachineFluidTank extends Container {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/*else if (!this.mergeItemStack(var5, 0, 2, false))
|
||||
else if (!this.mergeItemStack(var5, 0, 6, false))
|
||||
{
|
||||
return null;
|
||||
}*/
|
||||
}
|
||||
|
||||
if (var5.stackSize == 0)
|
||||
{
|
||||
|
||||
@ -26,12 +26,12 @@ public class ItemFluidIdentifier extends Item {
|
||||
this.setMaxDamage(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
/*@Override
|
||||
public String getUnlocalizedName(ItemStack stack)
|
||||
{
|
||||
int i = stack.getItemDamage();
|
||||
return super.getUnlocalizedName() + "." + FluidType.getEnum(i).getName();
|
||||
}
|
||||
}*/
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
|
||||
@ -318,13 +318,16 @@ 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 && ((TileEntityFluidDuct)tileentity).type == type)
|
||||
return true;
|
||||
if((tileentity != null && (tileentity instanceof IFluidAcceptor ||
|
||||
tileentity instanceof IFluidSource)) ||
|
||||
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)
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_chemplant ||
|
||||
world.getBlock(x, y, z) == ModBlocks.dummy_port_fluidtank)
|
||||
{
|
||||
if(((TileEntityFluidDuct)tileentity).type == type)
|
||||
return true;
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@ -368,7 +371,7 @@ public class Library {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean checkGasUnionListForFluids(List<UnionOfTileEntitiesAndBooleansForFluids> list, IFluidSource that) {
|
||||
public static boolean checkUnionListForFluids(List<UnionOfTileEntitiesAndBooleansForFluids> list, IFluidSource that) {
|
||||
|
||||
for(UnionOfTileEntitiesAndBooleansForFluids union : list)
|
||||
{
|
||||
@ -1160,11 +1163,17 @@ public class Library {
|
||||
Block block = worldObj.getBlock(x, y, z);
|
||||
TileEntity tileentity = worldObj.getTileEntity(x, y, z);
|
||||
|
||||
//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 IFluidDuct)
|
||||
{
|
||||
if(tileentity instanceof TileEntityFluidDuct && ((TileEntityFluidDuct)tileentity).type.name().equals(type.name()))
|
||||
{
|
||||
if(Library.checkGasUnionListForFluids(((TileEntityFluidDuct)tileentity).uoteab, that))
|
||||
if(Library.checkUnionListForFluids(((TileEntityFluidDuct)tileentity).uoteab, that))
|
||||
{
|
||||
for(int i = 0; i < ((TileEntityFluidDuct)tileentity).uoteab.size(); i++)
|
||||
{
|
||||
@ -1190,31 +1199,54 @@ public class Library {
|
||||
|
||||
if(tileentity instanceof IFluidAcceptor && newTact && !(tileentity instanceof TileEntityMachineFluidTank && ((TileEntityMachineFluidTank)tileentity).dna()))
|
||||
{
|
||||
that.getFluidList().add((IFluidAcceptor)tileentity);
|
||||
that.getFluidList(type).add((IFluidAcceptor)tileentity);
|
||||
}
|
||||
|
||||
if(!newTact)
|
||||
{
|
||||
int size = that.getFluidList().size();
|
||||
int size = that.getFluidList(type).size();
|
||||
if(size > 0)
|
||||
{
|
||||
int part = that.getFluidFill(type) / size;
|
||||
for(IFluidAcceptor consume : that.getFluidList())
|
||||
int part = that.getSFluidFill(type) / size;
|
||||
for(IFluidAcceptor consume : that.getFluidList(type))
|
||||
{
|
||||
if(consume.getFluidFill(type) < consume.getMaxFluidFill(type))
|
||||
if(consume.getAFluidFill(type) < consume.getMaxAFluidFill(type))
|
||||
{
|
||||
if(consume.getMaxFluidFill(type) - consume.getFluidFill(type) >= part)
|
||||
if(consume.getMaxAFluidFill(type) - consume.getAFluidFill(type) >= part)
|
||||
{
|
||||
that.setFluidFill(that.getFluidFill(type)-part, type);
|
||||
consume.setFluidFill(consume.getFluidFill(type) + part, type);
|
||||
that.setSFluidFill(that.getSFluidFill(type)-part, type);
|
||||
consume.setAFluidFill(consume.getAFluidFill(type) + part, type);
|
||||
} else {
|
||||
that.setFluidFill(that.getFluidFill(type) - (consume.getMaxFluidFill(type) - consume.getFluidFill(type)), type);
|
||||
consume.setFluidFill(consume.getMaxFluidFill(type), type);
|
||||
that.setSFluidFill(that.getSFluidFill(type) - (consume.getMaxAFluidFill(type) - consume.getAFluidFill(type)), type);
|
||||
consume.setAFluidFill(consume.getMaxAFluidFill(type), type);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
that.clearFluidList();
|
||||
that.clearFluidList(type);
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isArrayEmpty(Object[] array) {
|
||||
if(array == null)
|
||||
return true;
|
||||
if(array.length == 0)
|
||||
return true;
|
||||
|
||||
boolean flag = true;
|
||||
|
||||
for(int i = 0; i < array.length; i++) {
|
||||
if(array[i] != null)
|
||||
flag = false;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public static ItemStack carefulCopy(ItemStack stack) {
|
||||
if(stack == null)
|
||||
return null;
|
||||
else
|
||||
return stack.copy();
|
||||
}
|
||||
}
|
||||
|
||||
@ -174,6 +174,7 @@ import com.hbm.render.tileentity.RenderDecoBlock;
|
||||
import com.hbm.render.tileentity.RenderDecoBlockAlt;
|
||||
import com.hbm.render.tileentity.RenderDerrick;
|
||||
import com.hbm.render.tileentity.RenderFluidDuct;
|
||||
import com.hbm.render.tileentity.RenderFluidTank;
|
||||
import com.hbm.render.tileentity.RenderGasDuct;
|
||||
import com.hbm.render.tileentity.RenderGasFlare;
|
||||
import com.hbm.render.tileentity.RenderIGenerator;
|
||||
@ -226,6 +227,7 @@ import com.hbm.tileentity.TileEntityMachineAssembler;
|
||||
import com.hbm.tileentity.TileEntityMachineCentrifuge;
|
||||
import com.hbm.tileentity.TileEntityMachineChemplant;
|
||||
import com.hbm.tileentity.TileEntityMachineCyclotron;
|
||||
import com.hbm.tileentity.TileEntityMachineFluidTank;
|
||||
import com.hbm.tileentity.TileEntityMachineGasFlare;
|
||||
import com.hbm.tileentity.TileEntityMachinePuF6Tank;
|
||||
import com.hbm.tileentity.TileEntityMachineUF6Tank;
|
||||
@ -287,6 +289,7 @@ public class ClientProxy extends ServerProxy
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineMiningDrill.class, new RenderMiningDrill());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineAssembler.class, new RenderAssembler());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineChemplant.class, new RenderChemplant());
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityMachineFluidTank.class, new RenderFluidTank());
|
||||
|
||||
//RenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new RenderRocket());
|
||||
RenderingRegistry.registerEntityRenderingHandler(EntityRocket.class, new RenderSnowball(ModItems.man_core));
|
||||
|
||||
@ -158,6 +158,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;
|
||||
@ -467,6 +468,7 @@ public class MainRegistry
|
||||
GameRegistry.registerTileEntity(TileEntityMachineAssembler.class, "tileentity_assembly_machine");
|
||||
GameRegistry.registerTileEntity(TileEntityFluidDuct.class, "tileentity_universal_duct");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineChemplant.class, "tileentity_chemical_plant");
|
||||
GameRegistry.registerTileEntity(TileEntityMachineFluidTank.class, "tileentity_fluid_tank");
|
||||
|
||||
EntityRegistry.registerModEntity(EntityRocket.class, "entity_rocket", 0, this, 250, 1, true);
|
||||
EntityRegistry.registerModEntity(EntityNukeExplosion.class, "entity_nuke_explosion", 1, this, 250, 1, true);
|
||||
|
||||
95
com/hbm/render/tileentity/RenderFluidTank.java
Normal file
95
com/hbm/render/tileentity/RenderFluidTank.java
Normal file
@ -0,0 +1,95 @@
|
||||
package com.hbm.render.tileentity;
|
||||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.tileentity.TileEntityMachineIGenerator;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.model.AdvancedModelLoader;
|
||||
import net.minecraftforge.client.model.IModelCustom;
|
||||
|
||||
public class RenderFluidTank extends TileEntitySpecialRenderer {
|
||||
|
||||
private static final ResourceLocation body = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/fluidtank_main.obj");
|
||||
private static final ResourceLocation rotor = new ResourceLocation(/*"/assets/" + */RefStrings.MODID, "models/fluidtank_label.obj");
|
||||
private IModelCustom genModel;
|
||||
private IModelCustom rotModel;
|
||||
private ResourceLocation genTexture;
|
||||
private ResourceLocation rotTexture;
|
||||
|
||||
public RenderFluidTank()
|
||||
{
|
||||
genModel = AdvancedModelLoader.loadModel(body);
|
||||
rotModel = AdvancedModelLoader.loadModel(rotor);
|
||||
//gadgetTexture = new ResourceLocation(RefStrings.MODID, "textures/models/TheGadget3_.png");
|
||||
genTexture = new ResourceLocation(RefStrings.MODID, "textures/models/textureIGenRotor.png");
|
||||
rotTexture = new ResourceLocation(RefStrings.MODID, "textures/models/textureIGenRotor.png");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
switch(tileEntity.getBlockMetadata())
|
||||
{
|
||||
case 2:
|
||||
GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
//GL11.glTranslated(0.5D, 0.0D, 0.0D);
|
||||
case 4:
|
||||
GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
//GL11.glTranslated(0.5D, 0.0D, 0.0D);
|
||||
case 3:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
//GL11.glTranslated(0.5D, 0.0D, 0.0D);
|
||||
case 5:
|
||||
GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
//GL11.glTranslated(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
bindTexture(genTexture);
|
||||
|
||||
genModel.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
|
||||
renderTileEntityAt2(tileEntity, x, y, z, f);
|
||||
}
|
||||
|
||||
public void renderTileEntityAt2(TileEntity tileEntity, double x, double y, double z, float f)
|
||||
{
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_CULL_FACE);
|
||||
GL11.glRotatef(180, 0F, 1F, 0F);
|
||||
GL11.glRotatef(90, 0F, 1F, 0F);
|
||||
switch(tileEntity.getBlockMetadata())
|
||||
{
|
||||
case 2:
|
||||
GL11.glRotatef(90, 0F, 1F, 0F); break;
|
||||
//GL11.glTranslated(0.5D, 0.0D, 0.0D);
|
||||
case 4:
|
||||
GL11.glRotatef(180, 0F, 1F, 0F); break;
|
||||
//GL11.glTranslated(0.5D, 0.0D, 0.0D);
|
||||
case 3:
|
||||
GL11.glRotatef(270, 0F, 1F, 0F); break;
|
||||
//GL11.glTranslated(0.5D, 0.0D, 0.0D);
|
||||
case 5:
|
||||
GL11.glRotatef(0, 0F, 1F, 0F); break;
|
||||
//GL11.glTranslated(0.5D, 0.0D, 0.0D);
|
||||
}
|
||||
|
||||
bindTexture(rotTexture);
|
||||
rotModel.renderAll();
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.calc.UnionOfTileEntitiesAndBooleans;
|
||||
@ -22,8 +23,6 @@ public class TileEntityFluidDuct extends TileEntity implements IFluidDuct {
|
||||
public FluidType type = FluidType.NONE;
|
||||
public List<UnionOfTileEntitiesAndBooleansForFluids> uoteab = new ArrayList<UnionOfTileEntitiesAndBooleansForFluids>();
|
||||
|
||||
//public List<UnionOfTileEntitiesAndBooleansForGas> uoteab = new ArrayList<UnionOfTileEntitiesAndBooleansForGas>();
|
||||
|
||||
public TileEntityFluidDuct() {
|
||||
|
||||
}
|
||||
@ -60,15 +59,15 @@ public class TileEntityFluidDuct extends TileEntity implements IFluidDuct {
|
||||
@Override
|
||||
public void readFromNBT(NBTTagCompound nbt)
|
||||
{
|
||||
this.type = FluidType.values()[nbt.getInteger("fluid")];
|
||||
super.readFromNBT(nbt);
|
||||
type = FluidType.getEnum(nbt.getInteger("fluid"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT(NBTTagCompound nbt)
|
||||
{
|
||||
for(int i = 0; i < FluidType.values().length; i++)
|
||||
if(FluidType.values()[i] == this.type)
|
||||
nbt.setInteger("fluid", i);
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("fluid", Arrays.asList(FluidType.values()).indexOf(type));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -487,75 +487,6 @@ public class TileEntityMachineAssembler extends TileEntity implements ISidedInve
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSpace(ItemStack stack) {
|
||||
|
||||
ItemStack st = stack.copy();
|
||||
|
||||
if(st == null)
|
||||
return true;
|
||||
|
||||
for(int i = 1; i < 10; i++) {
|
||||
if(slots[i] == null)
|
||||
return true;
|
||||
}
|
||||
|
||||
int size = st.stackSize;
|
||||
st.stackSize = 1;
|
||||
|
||||
ItemStack[] fakeArray = slots.clone();
|
||||
boolean flag = true;
|
||||
for(int i = 0; i < stack.stackSize; i++) {
|
||||
if(!canAddItemToArray(st, fakeArray))
|
||||
flag = false;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void addItemToInventory(ItemStack stack) {
|
||||
|
||||
ItemStack st = stack.copy();
|
||||
|
||||
if(st == null)
|
||||
return;
|
||||
|
||||
int size = st.stackSize;
|
||||
st.stackSize = 1;
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
canAddItemToArray(st, this.slots);
|
||||
|
||||
}
|
||||
|
||||
public boolean canAddItemToArray(ItemStack stack, ItemStack[] array) {
|
||||
|
||||
ItemStack st = stack.copy();
|
||||
|
||||
if(st == null)
|
||||
return true;
|
||||
|
||||
for(int i = 1; i < 10; i++) {
|
||||
|
||||
if(array[i] != null) {
|
||||
ItemStack sta = array[i].copy();
|
||||
|
||||
if(sta != null && sta.getItem() == st.getItem() && sta.stackSize < st.getMaxStackSize()) {
|
||||
array[i].stackSize++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 1; i < 10; i++) {
|
||||
if(array[i] == null) {
|
||||
array[i] = stack.copy();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//boolean true: remove items, boolean false: simulation mode
|
||||
public boolean removeItems(List<ItemStack> stack, ItemStack[] array) {
|
||||
|
||||
|
||||
@ -1,11 +1,14 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
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.FluidStack;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.inventory.MachineRecipes;
|
||||
@ -20,6 +23,7 @@ import com.hbm.packet.TEAssemblerPacket;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.ISidedInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -31,7 +35,7 @@ import net.minecraft.tileentity.TileEntityHopper;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class TileEntityMachineChemplant extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer {
|
||||
public class TileEntityMachineChemplant extends TileEntity implements ISidedInventory, IConsumer, IFluidContainer, IFluidAcceptor, IFluidSource {
|
||||
|
||||
private ItemStack slots[];
|
||||
|
||||
@ -44,6 +48,8 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
int consumption = 100;
|
||||
int speed = 100;
|
||||
public FluidTank[] tanks;
|
||||
public List<IFluidAcceptor> list1 = new ArrayList();
|
||||
public List<IFluidAcceptor> list2 = new ArrayList();
|
||||
|
||||
Random rand = new Random();
|
||||
|
||||
@ -169,6 +175,11 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
|
||||
this.power = nbt.getInteger("powerTime");
|
||||
slots = new ItemStack[getSizeInventory()];
|
||||
|
||||
tanks[0].readFromNBT(nbt, "input1");
|
||||
tanks[1].readFromNBT(nbt, "input2");
|
||||
tanks[2].readFromNBT(nbt, "output1");
|
||||
tanks[3].readFromNBT(nbt, "output2");
|
||||
|
||||
for(int i = 0; i < list.tagCount(); i++)
|
||||
{
|
||||
@ -186,6 +197,11 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
super.writeToNBT(nbt);
|
||||
nbt.setInteger("powerTime", power);
|
||||
NBTTagList list = new NBTTagList();
|
||||
|
||||
tanks[0].writeToNBT(nbt, "input1");
|
||||
tanks[1].writeToNBT(nbt, "input2");
|
||||
tanks[2].writeToNBT(nbt, "output1");
|
||||
tanks[3].writeToNBT(nbt, "output2");
|
||||
|
||||
for(int i = 0; i < slots.length; i++)
|
||||
{
|
||||
@ -226,9 +242,59 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
this.consumption = 100;
|
||||
this.speed = 100;
|
||||
|
||||
for(int i = 1; i < 4; i++) {
|
||||
ItemStack stack = slots[i];
|
||||
|
||||
if(stack != null) {
|
||||
if(stack.getItem() == ModItems.upgrade_speed_1) {
|
||||
this.speed -= 25;
|
||||
this.consumption += 300;
|
||||
}
|
||||
if(stack.getItem() == ModItems.upgrade_speed_2) {
|
||||
this.speed -= 50;
|
||||
this.consumption += 600;
|
||||
}
|
||||
if(stack.getItem() == ModItems.upgrade_speed_3) {
|
||||
this.speed -= 75;
|
||||
this.consumption += 900;
|
||||
}
|
||||
if(stack.getItem() == ModItems.upgrade_power_1) {
|
||||
this.consumption -= 30;
|
||||
this.speed += 5;
|
||||
}
|
||||
if(stack.getItem() == ModItems.upgrade_power_2) {
|
||||
this.consumption -= 60;
|
||||
this.speed += 10;
|
||||
}
|
||||
if(stack.getItem() == ModItems.upgrade_power_3) {
|
||||
this.consumption -= 90;
|
||||
this.speed += 15;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(speed < 25)
|
||||
speed = 25;
|
||||
if(consumption < 10)
|
||||
consumption = 10;
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if(age == 9 || age == 19) {
|
||||
fillFluidInit(tanks[2].getTankType());
|
||||
//fillFluidInit(tanks[3].getTankType());
|
||||
}
|
||||
|
||||
setContainers();
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
|
||||
@ -241,6 +307,99 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
for(int i = 0; i < 4; i++) {
|
||||
tanks[i].updateTank(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
FluidStack[] inputs = MachineRecipes.getFluidInputFromTempate(slots[4]);
|
||||
FluidStack[] outputs = MachineRecipes.getFluidOutputFromTempate(slots[4]);
|
||||
|
||||
if((MachineRecipes.getChemInputFromTempate(slots[4]) != null || !Library.isArrayEmpty(inputs)) &&
|
||||
(MachineRecipes.getChemOutputFromTempate(slots[4]) != null || !Library.isArrayEmpty(outputs))) {
|
||||
this.maxProgress = (ItemChemistryTemplate.getProcessTime(slots[4]) * speed) / 100;
|
||||
|
||||
if(power >= consumption && removeItems(MachineRecipes.getChemInputFromTempate(slots[4]), cloneItemStackProper(slots)) && hasFluidsStored(inputs)) {
|
||||
|
||||
if(hasSpaceForItems(MachineRecipes.getChemOutputFromTempate(slots[4])) && hasSpaceForFluids(outputs)) {
|
||||
progress++;
|
||||
|
||||
rotation += 5;
|
||||
|
||||
if(rotation >= 360)
|
||||
rotation -= 360;
|
||||
|
||||
if(progress >= maxProgress) {
|
||||
progress = 0;
|
||||
|
||||
addItems(MachineRecipes.getChemOutputFromTempate(slots[4]));
|
||||
addFluids(outputs);
|
||||
|
||||
removeItems(MachineRecipes.getChemInputFromTempate(slots[4]), slots);
|
||||
removeFluids(inputs);
|
||||
}
|
||||
|
||||
power -= consumption;
|
||||
}
|
||||
} else
|
||||
progress = 0;
|
||||
} else
|
||||
progress = 0;
|
||||
|
||||
int meta = worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
|
||||
TileEntity te = null;
|
||||
if(meta == 2) {
|
||||
te = worldObj.getTileEntity(xCoord - 2, yCoord, zCoord);
|
||||
}
|
||||
if(meta == 3) {
|
||||
te = worldObj.getTileEntity(xCoord + 2, yCoord, zCoord);
|
||||
}
|
||||
if(meta == 4) {
|
||||
te = worldObj.getTileEntity(xCoord, yCoord, zCoord + 2);
|
||||
}
|
||||
if(meta == 5) {
|
||||
te = worldObj.getTileEntity(xCoord, yCoord, zCoord - 2);
|
||||
}
|
||||
|
||||
if(te != null && te instanceof TileEntityChest) {
|
||||
TileEntityChest chest = (TileEntityChest)te;
|
||||
|
||||
for(int i = 5; i < 9; i++)
|
||||
tryFillContainer(chest, i);
|
||||
}
|
||||
|
||||
if(te != null && te instanceof TileEntityHopper) {
|
||||
TileEntityHopper hopper = (TileEntityHopper)te;
|
||||
|
||||
for(int i = 5; i < 9; i++)
|
||||
tryFillContainer(hopper, i);
|
||||
}
|
||||
|
||||
te = null;
|
||||
if(meta == 2) {
|
||||
te = worldObj.getTileEntity(xCoord + 3, yCoord, zCoord - 1);
|
||||
}
|
||||
if(meta == 3) {
|
||||
te = worldObj.getTileEntity(xCoord - 3, yCoord, zCoord + 1);
|
||||
}
|
||||
if(meta == 4) {
|
||||
te = worldObj.getTileEntity(xCoord - 1, yCoord, zCoord - 3);
|
||||
}
|
||||
if(meta == 5) {
|
||||
te = worldObj.getTileEntity(xCoord + 1, yCoord, zCoord + 3);
|
||||
}
|
||||
|
||||
if(te != null && te instanceof TileEntityChest) {
|
||||
TileEntityChest chest = (TileEntityChest)te;
|
||||
|
||||
for(int i = 0; i < chest.getSizeInventory(); i++)
|
||||
if(tryFillAssembler(chest, i))
|
||||
break;
|
||||
}
|
||||
|
||||
if(te != null && te instanceof TileEntityHopper) {
|
||||
TileEntityHopper hopper = (TileEntityHopper)te;
|
||||
|
||||
for(int i = 0; i < hopper.getSizeInventory(); i++)
|
||||
if(tryFillAssembler(hopper, i))
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -259,6 +418,107 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
}
|
||||
}
|
||||
|
||||
public boolean hasFluidsStored(FluidStack[] fluids) {
|
||||
if(Library.isArrayEmpty(fluids))
|
||||
return true;
|
||||
|
||||
if((fluids[0] == null || fluids[0] != null && fluids[0].fill <= tanks[0].getFill()) &&
|
||||
(fluids[1] == null || fluids[1] != null && fluids[1].fill <= tanks[1].getFill()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSpaceForFluids(FluidStack[] fluids) {
|
||||
if(Library.isArrayEmpty(fluids))
|
||||
return true;
|
||||
|
||||
if((fluids[0] == null || fluids[0] != null && tanks[2].getFill() + fluids[0].fill <= tanks[2].getMaxFill()) &&
|
||||
(fluids[1] == null || fluids[1] != null && tanks[3].getFill() + fluids[1].fill <= tanks[3].getMaxFill()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void removeFluids(FluidStack[] fluids) {
|
||||
if(Library.isArrayEmpty(fluids))
|
||||
return;
|
||||
|
||||
if(fluids[0] != null)
|
||||
tanks[0].setFill(tanks[0].getFill() - fluids[0].fill);
|
||||
if(fluids[1] != null)
|
||||
tanks[1].setFill(tanks[1].getFill() - fluids[1].fill);
|
||||
}
|
||||
|
||||
public boolean hasSpaceForItems(ItemStack[] stacks) {
|
||||
if(stacks == null)
|
||||
return true;
|
||||
if(stacks != null && Library.isArrayEmpty(stacks))
|
||||
return true;
|
||||
|
||||
ItemStack sta0 = Library.carefulCopy(slots[5]);
|
||||
if(sta0 != null)
|
||||
sta0.stackSize = 1;
|
||||
ItemStack sta1 = Library.carefulCopy(stacks[0]);
|
||||
if(sta1 != null)
|
||||
sta1.stackSize = 1;
|
||||
ItemStack sta2 = Library.carefulCopy(slots[6]);
|
||||
if(sta2 != null)
|
||||
sta2.stackSize = 1;
|
||||
ItemStack sta3 = Library.carefulCopy(stacks[1]);
|
||||
if(sta3 != null)
|
||||
sta3.stackSize = 1;
|
||||
ItemStack sta4 = Library.carefulCopy(slots[7]);
|
||||
if(sta4 != null)
|
||||
sta4.stackSize = 1;
|
||||
ItemStack sta5 = Library.carefulCopy(stacks[2]);
|
||||
if(sta5 != null)
|
||||
sta5.stackSize = 1;
|
||||
ItemStack sta6 = Library.carefulCopy(slots[8]);
|
||||
if(sta6 != null)
|
||||
sta6.stackSize = 1;
|
||||
ItemStack sta7 = Library.carefulCopy(stacks[3]);
|
||||
if(sta7 != null)
|
||||
sta7.stackSize = 1;
|
||||
|
||||
if(slots[5] == null || stacks[0] == null || (stacks[0] != null && ItemStack.areItemStacksEqual(sta0, sta1) && ItemStack.areItemStackTagsEqual(sta0, sta1) && slots[5].stackSize + stacks[0].stackSize <= slots[5].getMaxStackSize()) &&
|
||||
slots[6] == null || stacks[1] == null || (stacks[1] != null && ItemStack.areItemStacksEqual(sta2, sta3) && ItemStack.areItemStackTagsEqual(sta2, sta3) && slots[6].stackSize + stacks[1].stackSize <= slots[6].getMaxStackSize()) &&
|
||||
slots[7] == null || stacks[2] == null || (stacks[2] != null && ItemStack.areItemStacksEqual(sta4, sta5) && ItemStack.areItemStackTagsEqual(sta4, sta5) && slots[7].stackSize + stacks[2].stackSize <= slots[7].getMaxStackSize()) &&
|
||||
slots[8] == null || stacks[3] == null || (stacks[3] != null && ItemStack.areItemStacksEqual(sta6, sta7) && ItemStack.areItemStackTagsEqual(sta6, sta7) && slots[8].stackSize + stacks[3].stackSize <= slots[8].getMaxStackSize()))
|
||||
return true;
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
public void addItems(ItemStack[] stacks) {
|
||||
if(slots[5] == null && stacks[0] != null)
|
||||
slots[5] = stacks[0].copy();
|
||||
else if (slots[5] != null && stacks[0] != null)
|
||||
slots[5].stackSize += stacks[0].stackSize;
|
||||
|
||||
if(slots[6] == null && stacks[1] != null)
|
||||
slots[6] = stacks[1].copy();
|
||||
else if (slots[6] != null && stacks[1] != null)
|
||||
slots[6].stackSize += stacks[1].stackSize;
|
||||
|
||||
if(slots[7] == null && stacks[2] != null)
|
||||
slots[7] = stacks[2].copy();
|
||||
else if (slots[7] != null && stacks[2] != null)
|
||||
slots[7].stackSize += stacks[2].stackSize;
|
||||
|
||||
if(slots[8] == null && stacks[3] != null)
|
||||
slots[8] = stacks[3].copy();
|
||||
else if (slots[8] != null && stacks[3] != null)
|
||||
slots[8].stackSize += stacks[3].stackSize;
|
||||
}
|
||||
|
||||
public void addFluids(FluidStack[] stacks) {
|
||||
if(stacks[0] != null)
|
||||
tanks[2].setFill(tanks[2].getFill() + stacks[0].fill);
|
||||
if(stacks[1] != null)
|
||||
tanks[3].setFill(tanks[3].getFill() + stacks[1].fill);
|
||||
}
|
||||
|
||||
//I can't believe that worked.
|
||||
public ItemStack[] cloneItemStackProper(ItemStack[] array) {
|
||||
ItemStack[] stack = new ItemStack[array.length];
|
||||
@ -328,11 +588,15 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
|
||||
//Loads assembler's input queue from chests
|
||||
public boolean tryFillAssembler(IInventory inventory, int slot) {
|
||||
|
||||
FluidStack[] inputs = MachineRecipes.getFluidInputFromTempate(slots[4]);
|
||||
FluidStack[] outputs = MachineRecipes.getFluidOutputFromTempate(slots[4]);
|
||||
|
||||
if(MachineRecipes.getOutputFromTempate(slots[4]) == null || MachineRecipes.getRecipeFromTempate(slots[4]) == null)
|
||||
if(!((MachineRecipes.getChemInputFromTempate(slots[4]) != null || !Library.isArrayEmpty(inputs)) &&
|
||||
(MachineRecipes.getChemOutputFromTempate(slots[4]) != null || !Library.isArrayEmpty(outputs))))
|
||||
return false;
|
||||
else {
|
||||
List<ItemStack> list = MachineRecipes.getRecipeFromTempate(slots[4]);
|
||||
List<ItemStack> list = MachineRecipes.getChemInputFromTempate(slots[4]);
|
||||
|
||||
for(int i = 0; i < list.size(); i++)
|
||||
list.get(i).stackSize = 1;
|
||||
@ -355,7 +619,7 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
|
||||
}
|
||||
|
||||
for(int i = 6; i < 18; i++) {
|
||||
for(int i = 13; i < 17; i++) {
|
||||
|
||||
if(slots[i] != null) {
|
||||
|
||||
@ -379,7 +643,7 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 6; i < 18; i++) {
|
||||
for(int i = 13; i < 17; i++) {
|
||||
|
||||
ItemStack sta2 = inventory.getStackInSlot(slot).copy();
|
||||
if(slots[i] == null && sta2 != null) {
|
||||
@ -399,75 +663,6 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean hasSpace(ItemStack stack) {
|
||||
|
||||
ItemStack st = stack.copy();
|
||||
|
||||
if(st == null)
|
||||
return true;
|
||||
|
||||
for(int i = 1; i < 10; i++) {
|
||||
if(slots[i] == null)
|
||||
return true;
|
||||
}
|
||||
|
||||
int size = st.stackSize;
|
||||
st.stackSize = 1;
|
||||
|
||||
ItemStack[] fakeArray = slots.clone();
|
||||
boolean flag = true;
|
||||
for(int i = 0; i < stack.stackSize; i++) {
|
||||
if(!canAddItemToArray(st, fakeArray))
|
||||
flag = false;
|
||||
}
|
||||
|
||||
return flag;
|
||||
}
|
||||
|
||||
public void addItemToInventory(ItemStack stack) {
|
||||
|
||||
ItemStack st = stack.copy();
|
||||
|
||||
if(st == null)
|
||||
return;
|
||||
|
||||
int size = st.stackSize;
|
||||
st.stackSize = 1;
|
||||
|
||||
for(int i = 0; i < size; i++)
|
||||
canAddItemToArray(st, this.slots);
|
||||
|
||||
}
|
||||
|
||||
public boolean canAddItemToArray(ItemStack stack, ItemStack[] array) {
|
||||
|
||||
ItemStack st = stack.copy();
|
||||
|
||||
if(st == null)
|
||||
return true;
|
||||
|
||||
for(int i = 1; i < 10; i++) {
|
||||
|
||||
if(array[i] != null) {
|
||||
ItemStack sta = array[i].copy();
|
||||
|
||||
if(sta != null && sta.getItem() == st.getItem() && sta.stackSize < st.getMaxStackSize()) {
|
||||
array[i].stackSize++;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 1; i < 10; i++) {
|
||||
if(array[i] == null) {
|
||||
array[i] = stack.copy();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
//boolean true: remove items, boolean false: simulation mode
|
||||
public boolean removeItems(List<ItemStack> stack, ItemStack[] array) {
|
||||
|
||||
@ -495,7 +690,7 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
if(st == null)
|
||||
return true;
|
||||
|
||||
for(int i = 6; i < 18; i++) {
|
||||
for(int i = 13; i < 17; i++) {
|
||||
|
||||
if(array[i] != null) {
|
||||
ItemStack sta = array[i].copy();
|
||||
@ -575,4 +770,134 @@ public class TileEntityMachineChemplant extends TileEntity implements ISidedInve
|
||||
if(index < 4 && tanks[index] != null)
|
||||
tanks[index].setTankType(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setAFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
tanks[0].setFill(i);
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
tanks[1].setFill(i);
|
||||
else if(type.name().equals(tanks[2].getTankType().name()))
|
||||
tanks[2].setFill(i);
|
||||
else if(type.name().equals(tanks[3].getTankType().name()))
|
||||
tanks[3].setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getAFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getFill();
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getFill();
|
||||
else if(type.name().equals(tanks[2].getTankType().name()))
|
||||
return tanks[2].getFill();
|
||||
else if(type.name().equals(tanks[3].getTankType().name()))
|
||||
return tanks[3].getFill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
tanks[0].setFill(i);
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
tanks[1].setFill(i);
|
||||
else if(type.name().equals(tanks[2].getTankType().name()))
|
||||
tanks[2].setFill(i);
|
||||
else if(type.name().equals(tanks[3].getTankType().name()))
|
||||
tanks[3].setFill(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getFill();
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getFill();
|
||||
else if(type.name().equals(tanks[2].getTankType().name()))
|
||||
return tanks[2].getFill();
|
||||
else if(type.name().equals(tanks[3].getTankType().name()))
|
||||
return tanks[3].getFill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxAFluidFill(FluidType type) {
|
||||
if(type.name().equals(tanks[0].getTankType().name()))
|
||||
return tanks[0].getMaxFill();
|
||||
else if(type.name().equals(tanks[1].getTankType().name()))
|
||||
return tanks[1].getMaxFill();
|
||||
else if(type.name().equals(tanks[2].getTankType().name()))
|
||||
return tanks[1].getMaxFill();
|
||||
else if(type.name().equals(tanks[3].getTankType().name()))
|
||||
return tanks[1].getMaxFill();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillFluidInit(FluidType type) {
|
||||
int meta = worldObj.getBlockMetadata(this.xCoord, this.yCoord, this.zCoord);
|
||||
if(meta == 5) {
|
||||
fillFluid(this.xCoord - 2, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord - 2, this.yCoord, this.zCoord + 1, getTact(), type);
|
||||
fillFluid(this.xCoord + 3, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord + 3, this.yCoord, this.zCoord + 1, getTact(), type);
|
||||
}
|
||||
|
||||
if(meta == 3) {
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord - 2, getTact(), type);
|
||||
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord - 2, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord + 3, getTact(), type);
|
||||
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord + 3, getTact(), type);
|
||||
}
|
||||
|
||||
if(meta == 2) {
|
||||
fillFluid(this.xCoord + 2, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord + 2, this.yCoord, this.zCoord - 1, getTact(), type);
|
||||
fillFluid(this.xCoord - 3, this.yCoord, this.zCoord, getTact(), type);
|
||||
fillFluid(this.xCoord - 3, this.yCoord, this.zCoord - 1, getTact(), type);
|
||||
}
|
||||
|
||||
if(meta == 4) {
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord + 2, getTact(), type);
|
||||
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord + 2, getTact(), type);
|
||||
fillFluid(this.xCoord, this.yCoord, this.zCoord - 3, getTact(), type);
|
||||
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord - 3, getTact(), type);
|
||||
}
|
||||
fillFluid(this.xCoord, this.yCoord - 1, this.zCoord, 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 List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
if(type.name().equals(tanks[2].getTankType().name()))
|
||||
return list1;
|
||||
if(type.name().equals(tanks[3].getTankType().name()))
|
||||
return list2;
|
||||
return new ArrayList<IFluidAcceptor>();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList(FluidType type) {
|
||||
if(type.name().equals(tanks[2].getTankType().name()))
|
||||
list1.clear();
|
||||
if(type.name().equals(tanks[3].getTankType().name()))
|
||||
list2.clear();
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.interfaces.IFluidAcceptor;
|
||||
import com.hbm.interfaces.IFluidContainer;
|
||||
import com.hbm.interfaces.IFluidSource;
|
||||
import com.hbm.interfaces.IMultiblock;
|
||||
import com.hbm.inventory.FluidTank;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.lib.Library;
|
||||
@ -200,6 +201,15 @@ public class TileEntityMachineFluidTank extends TileEntity implements ISidedInve
|
||||
|
||||
if(!worldObj.isRemote)
|
||||
{
|
||||
age++;
|
||||
if(age >= 20)
|
||||
{
|
||||
age = 0;
|
||||
}
|
||||
|
||||
if((age == 9 || age == 19) && dna())
|
||||
fillFluidInit(tank.getTankType());
|
||||
|
||||
tank.loadTank(2, 3, slots);
|
||||
tank.setType(0, 1, slots);
|
||||
tank.unloadTank(4, 5, slots);
|
||||
@ -236,18 +246,20 @@ public class TileEntityMachineFluidTank extends TileEntity implements ISidedInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxFluidFill(FluidType type) {
|
||||
public int getMaxAFluidFill(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);
|
||||
fillFluid(this.xCoord + 2, this.yCoord, this.zCoord - 1, getTact(), type);
|
||||
fillFluid(this.xCoord + 2, this.yCoord, this.zCoord + 1, getTact(), type);
|
||||
fillFluid(this.xCoord - 2, this.yCoord, this.zCoord - 1, getTact(), type);
|
||||
fillFluid(this.xCoord - 2, this.yCoord, this.zCoord + 1, getTact(), type);
|
||||
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord + 2, getTact(), type);
|
||||
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord + 2, getTact(), type);
|
||||
fillFluid(this.xCoord - 1, this.yCoord, this.zCoord - 2, getTact(), type);
|
||||
fillFluid(this.xCoord + 1, this.yCoord, this.zCoord - 2, getTact(), type);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -265,24 +277,34 @@ public class TileEntityMachineFluidTank extends TileEntity implements ISidedInve
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFluidFill(FluidType type) {
|
||||
public int getAFluidFill(FluidType type) {
|
||||
return type.name().equals(this.tank.getTankType().name()) ? tank.getFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFluidFill(int i, FluidType type) {
|
||||
public void setAFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tank.getTankType().name()))
|
||||
tank.setFill(i);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IFluidAcceptor> getFluidList() {
|
||||
public List<IFluidAcceptor> getFluidList(FluidType type) {
|
||||
return this.list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void clearFluidList() {
|
||||
public void clearFluidList(FluidType type) {
|
||||
this.list.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSFluidFill(FluidType type) {
|
||||
return type.name().equals(this.tank.getTankType().name()) ? tank.getFill() : 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSFluidFill(int i, FluidType type) {
|
||||
if(type.name().equals(tank.getTankType().name()))
|
||||
tank.setFill(i);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user