gas centrifuge shenanigans

very, very WIP
This commit is contained in:
Vaern 2021-12-16 19:38:17 -08:00
parent da704ddd64
commit df4bc5c32e
6 changed files with 372 additions and 247 deletions

View File

@ -1186,7 +1186,6 @@ public class ModBlocks {
public static Block dummy_port_reactor_small;
public static Block dummy_block_vault;
public static Block dummy_block_blast;
public static Block dummy_block_gascent;
public static Block dummy_block_uf6;
public static Block dummy_block_puf6;
public static Block dummy_plate_compact_launcher;
@ -1702,7 +1701,7 @@ public class ModBlocks {
machine_difurnace_rtg_on = new MachineDiFurnaceRTG(true).setBlockName("machine_difurnace_rtg_on").setHardness(5.0F).setResistance(10.0F).setLightLevel(2.0F).setCreativeTab(null);
machine_centrifuge = new MachineCentrifuge(Material.iron).setBlockName("machine_centrifuge").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_gascent = new MachineGasCent(Material.iron).setBlockName("machine_gascent").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
machine_gascent = new MachineGasCent(Material.iron).setBlockName("machine_gascent").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_fel = new MachineFEL(Material.iron).setBlockName("machine_fel").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_silex = new MachineSILEX(Material.iron).setBlockName("machine_silex").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
machine_crystallizer = new MachineCrystallizer(Material.iron).setBlockName("machine_crystallizer").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":machine_crystallizer");
@ -2189,7 +2188,6 @@ public class ModBlocks {
dummy_port_reactor_small = new DummyBlockMachine(Material.iron, guiID_reactor_small, machine_reactor_small, false).setBlockName("dummy_port_reactor_small").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_block_vault = new DummyBlockVault(Material.iron).setBlockName("dummy_block_vault").setHardness(10.0F).setResistance(10000.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_block_blast = new DummyBlockBlast(Material.iron).setBlockName("dummy_block_blast").setHardness(10.0F).setResistance(10000.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_block_gascent = new DummyBlockMachine(Material.iron, guiID_gascent, machine_gascent, false).setBlockName("dummy_block_gascent").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_block_uf6 = new DummyBlockMachine(Material.iron, guiID_uf6_tank, machine_uf6_tank, false).setBlockName("dummy_block_uf6").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_titanium");
dummy_block_puf6 = new DummyBlockMachine(Material.iron, guiID_puf6_tank, machine_puf6_tank, false).setBlockName("dummy_block_puf6").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
dummy_plate_compact_launcher = new DummyBlockMachine(Material.iron, guiID_compact_launcher, compact_launcher, false).setBounds(0, 16, 0, 16, 16, 16).setBlockName("dummy_plate_compact_launcher").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_steel");
@ -3153,7 +3151,6 @@ public class ModBlocks {
GameRegistry.registerBlock(dummy_port_reactor_small, dummy_port_reactor_small.getUnlocalizedName());
GameRegistry.registerBlock(dummy_block_vault, dummy_block_vault.getUnlocalizedName());
GameRegistry.registerBlock(dummy_block_blast, dummy_block_blast.getUnlocalizedName());
GameRegistry.registerBlock(dummy_block_gascent, dummy_block_gascent.getUnlocalizedName());
GameRegistry.registerBlock(dummy_block_uf6, dummy_block_uf6.getUnlocalizedName());
GameRegistry.registerBlock(dummy_block_puf6, dummy_block_puf6.getUnlocalizedName());
GameRegistry.registerBlock(dummy_plate_compact_launcher, dummy_plate_compact_launcher.getUnlocalizedName());

View File

@ -2,11 +2,14 @@ package com.hbm.blocks.machine;
import java.util.Random;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.handler.MultiblockHandler;
import com.hbm.handler.MultiblockHandlerXR;
import com.hbm.interfaces.IMultiblock;
import com.hbm.lib.RefStrings;
import com.hbm.main.MainRegistry;
import com.hbm.tileentity.TileEntityProxyCombo;
import com.hbm.tileentity.machine.TileEntityMachineGasCent;
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
@ -25,127 +28,24 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineGasCent extends BlockContainer implements IMultiblock {
private final Random field_149933_a = new Random();
private static boolean keepInventory;
public class MachineGasCent extends BlockDummyable implements IMultiblock {
public MachineGasCent(Material p_i45386_1_) {
super(p_i45386_1_);
}
@Override
public int getRenderType(){
return -1;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public boolean renderAsNormalBlock() {
return false;
}
@Override
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister iconregister) {
this.blockIcon = iconregister.registerIcon(RefStrings.MODID + ":machine_gascent");
public MachineGasCent(Material mat) {
super(mat);
}
@Override
public TileEntity createNewTileEntity(World p_149915_1_, int p_149915_2_) {
return new TileEntityMachineGasCent();
public TileEntity createNewTileEntity(World world, int meta) {
if(meta >= 12)
return new TileEntityMachineGasCent();
if(meta >= 6)
return new TileEntityProxyCombo(false, true, true);
return null;
}
@Override
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_)
{
return Item.getItemFromBlock(ModBlocks.machine_gascent);
}
@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, 2, 2);
}
if(i == 1)
{
world.setBlockMetadataWithNotify(x, y, z, 5, 2);
}
if(i == 2)
{
world.setBlockMetadataWithNotify(x, y, z, 3, 2);
}
if(i == 3)
{
world.setBlockMetadataWithNotify(x, y, z, 4, 2);
}
if(MultiblockHandler.checkSpace(world, x, y, z, MultiblockHandler.centDimension)) {
MultiblockHandler.fillUp(world, x, y, z, MultiblockHandler.centDimension, ModBlocks.dummy_block_gascent);
} else
world.func_147480_a(x, y, z, true);
}
@Override
public void breakBlock(World p_149749_1_, int p_149749_2_, int p_149749_3_, int p_149749_4_, Block p_149749_5_, int p_149749_6_)
{
if (!keepInventory)
{
TileEntityMachineGasCent tileentityfurnace = (TileEntityMachineGasCent)p_149749_1_.getTileEntity(p_149749_2_, p_149749_3_, p_149749_4_);
if (tileentityfurnace != null)
{
for (int i1 = 0; i1 < tileentityfurnace.getSizeInventory(); ++i1)
{
ItemStack itemstack = tileentityfurnace.getStackInSlot(i1);
if (itemstack != null)
{
float f = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
float f1 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
float f2 = this.field_149933_a.nextFloat() * 0.8F + 0.1F;
while (itemstack.stackSize > 0)
{
int j1 = this.field_149933_a.nextInt(21) + 10;
if (j1 > itemstack.stackSize)
{
j1 = itemstack.stackSize;
}
itemstack.stackSize -= j1;
EntityItem entityitem = new EntityItem(p_149749_1_, p_149749_2_ + f, p_149749_3_ + f1, p_149749_4_ + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage()));
if (itemstack.hasTagCompound())
{
entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy());
}
float f3 = 0.05F;
entityitem.motionX = (float)this.field_149933_a.nextGaussian() * f3;
entityitem.motionY = (float)this.field_149933_a.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float)this.field_149933_a.nextGaussian() * f3;
p_149749_1_.spawnEntityInWorld(entityitem);
}
}
}
p_149749_1_.func_147453_f(p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_);
}
}
super.breakBlock(p_149749_1_, p_149749_2_, p_149749_3_, p_149749_4_, p_149749_5_, p_149749_6_);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
@ -154,14 +54,29 @@ public class MachineGasCent extends BlockContainer implements IMultiblock {
return true;
} else if(!player.isSneaking())
{
TileEntityMachineGasCent entity = (TileEntityMachineGasCent) world.getTileEntity(x, y, z);
if(entity != null)
{
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_gascent, world, x, y, z);
}
int[] pos = this.findCore(world, x, y, z);
if(pos == null)
return false;
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_gascent, world, pos[0], pos[1], pos[2]);
return true;
} else {
return false;
}
}
@Override
public int[] getDimensions() {
return new int[] {2, 0, 0, 0, 0, 0,};
}
@Override
public int getOffset() {
return 0;
}
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
}
}

View File

@ -160,7 +160,6 @@ public class EntityFBI extends EntityMob implements IRangedAttackMob {
canDestroy.add(ModBlocks.dummy_block_assembler);
canDestroy.add(ModBlocks.dummy_block_chemplant);
canDestroy.add(ModBlocks.dummy_block_centrifuge);
canDestroy.add(ModBlocks.dummy_block_gascent);
canDestroy.add(ModBlocks.machine_crystallizer);
canDestroy.add(ModBlocks.dummy_block_reactor_small);
canDestroy.add(ModBlocks.dummy_port_reactor_small);

View File

@ -0,0 +1,50 @@
package com.hbm.inventory.recipes;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.items.ModItems;
import net.minecraft.item.ItemStack;
public class GasCentrifugeRecipes {
public static enum PseudoFluidType {
NONE (0, 0, "NONE", new ItemStack(ModItems.polaroid, 0)),
NUF6 (400, 300, "LEUF6", new ItemStack(ModItems.nugget_u238, 1)),
LEUF6 (300, 200, "MEUF6", new ItemStack(ModItems.nugget_u238, 1)),
MEUF6 (200, 100, "HEUF6", new ItemStack(ModItems.nugget_u238, 1)),
HEUF6 (100, 0, "NONE", new ItemStack(ModItems.nugget_u238, 2), new ItemStack(ModItems.nugget_u235, 1)),
PF6 (300, 0, "NONE", new ItemStack(ModItems.nugget_pu238, 1), new ItemStack(ModItems.nugget_pu_mix, 2));
int fluidConsumed;
int fluidProduced;
String outputFluid;
ItemStack[] output;
PseudoFluidType(int fluidConsumed, int fluidProduced, String outputFluid, ItemStack... output) {
this.fluidConsumed = fluidConsumed;
this.fluidProduced = fluidProduced;
this.outputFluid = outputFluid;
this.output = output;
}
public int getFluidConsumed() {
return this.fluidConsumed;
}
public int getFluidProduced() {
return this.fluidProduced;
}
public PseudoFluidType getOutputFluid() {
return this.valueOf(this.outputFluid);
}
public ItemStack[] getOutput() {
return this.output;
}
};
}

View File

@ -98,7 +98,6 @@ public class NEIConfig implements IConfigureNEI {
API.hideItem(new ItemStack(ModBlocks.dummy_block_radgen));
API.hideItem(new ItemStack(ModBlocks.dummy_block_vault));
API.hideItem(new ItemStack(ModBlocks.dummy_block_blast));
API.hideItem(new ItemStack(ModBlocks.dummy_block_gascent));
API.hideItem(new ItemStack(ModBlocks.dummy_block_uf6));
API.hideItem(new ItemStack(ModBlocks.dummy_block_puf6));
API.hideItem(new ItemStack(ModBlocks.dummy_port_assembler));

View File

@ -4,17 +4,22 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.hbm.blocks.BlockDummyable;
import com.hbm.handler.FluidTypeHandler.FluidType;
import com.hbm.interfaces.IFluidAcceptor;
import com.hbm.interfaces.IFluidContainer;
import com.hbm.inventory.FluidTank;
import com.hbm.inventory.recipes.GasCentrifugeRecipes;
import com.hbm.inventory.recipes.GasCentrifugeRecipes.PseudoFluidType;
import com.hbm.inventory.recipes.MachineRecipes;
import com.hbm.inventory.recipes.MachineRecipes.GasCentOutput;
import com.hbm.items.ModItems;
import com.hbm.lib.Library;
import com.hbm.packet.AuxElectricityPacket;
import com.hbm.packet.AuxGaugePacket;
import com.hbm.packet.LoopedSoundPacket;
import com.hbm.packet.PacketDispatcher;
import com.hbm.tileentity.TileEntityMachineBase;
import api.hbm.energy.IEnergyUser;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
@ -28,10 +33,9 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityMachineGasCent extends TileEntity implements ISidedInventory, IEnergyUser, IFluidContainer, IFluidAcceptor {
private ItemStack slots[];
public class TileEntityMachineGasCent extends TileEntityMachineBase implements IEnergyUser, IFluidContainer, IFluidAcceptor {
public long power;
public int progress;
@ -40,6 +44,8 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
public static final int processingSpeed = 200;
public FluidTank tank;
public PseudoFluidTank inputTank;
public PseudoFluidTank outputTank;
private static final int[] slots_top = new int[] {3};
private static final int[] slots_bottom = new int[] {5, 6, 7, 8};
@ -47,107 +53,18 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
private String customName;
//TODO add inter-TE communications (outputting pseudofluids to other gascents, setting pseudofluidtype for other gascents, etc.)
//Check the TileEntityPileBase for how to do this, tis pretty easy
public TileEntityMachineGasCent() {
slots = new ItemStack[9];
tank = new FluidTank(FluidType.UF6, 8000, 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.gasCentrifuge";
}
@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;
}
}
//You scrubs aren't needed for anything (right now)
@Override
public void openInventory() {}
@Override
public void closeInventory() {}
@Override
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
if(i == 2 || i == 3 || i == 4 || i == 5)
{
return false;
}
super(9); //6 slots
tank = new FluidTank(FluidType.UF6, 4000, 0);
inputTank = new PseudoFluidTank(PseudoFluidType.NUF6, 8000);
return true;
}
@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;
}
public String getName() {
return "container.gasCentrifuge";
}
@Override
@ -155,9 +72,11 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
super.readFromNBT(nbt);
NBTTagList list = nbt.getTagList("items", 10);
power = nbt.getLong("powerTime");
progress = nbt.getShort("CookTime");
power = nbt.getLong("power");
progress = nbt.getShort("progress");
tank.readFromNBT(nbt, "tank");
inputTank.readFromNBT(nbt, "inputTank");
outputTank.readFromNBT(nbt, "outputTank");
slots = new ItemStack[getSizeInventory()];
for(int i = 0; i < list.tagCount(); i++)
@ -174,9 +93,11 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
@Override
public void writeToNBT(NBTTagCompound nbt) {
super.writeToNBT(nbt);
nbt.setLong("powerTime", power);
nbt.setShort("cookTime", (short) progress);
nbt.setLong("power", power);
nbt.setShort("progress", (short) progress);
tank.writeToNBT(nbt, "tank");
inputTank.writeToNBT(nbt, "inputTank");
outputTank.writeToNBT(nbt, "outputTank");
NBTTagList list = new NBTTagList();
for(int i = 0; i < slots.length; i++)
@ -193,19 +114,14 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
}
@Override
public int[] getAccessibleSlotsFromSide(int p_94128_1_)
public int[] getAccessibleSlotsFromSide(int meta)
{
return p_94128_1_ == 0 ? slots_bottom : (p_94128_1_ == 1 ? slots_top : slots_side);
return meta == 0 ? slots_bottom : (meta == 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 j != 0 || i != 1 || itemStack.getItem() == Items.bucket;
return j != 0 || i != 1;
}
public int getCentrifugeProgressScaled(int i) {
@ -276,6 +192,88 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
}
}
private boolean canEnrich() {
if(power > 0 && this.inputTank.getFill() >= inputTank.getTankType().getFluidConsumed() && this.outputTank.getFill() <= outputTank.getMaxFill()) {
ItemStack[] list = inputTank.getTankType().getOutput();
if(list == null)
return false;
if(list.length < 1 || list.length > 3)
return false;
for(int i = 0; i < list.length; i++) {
int slot = i + 2;
if(slots[slot] == null)
continue;
if(slots[slot].getItem() == list[i].getItem() &&
slots[slot].getItemDamage() == list[i].getItemDamage() &&
slots[slot].stackSize + list[i].stackSize <= slots[slot].getMaxStackSize())
continue;
return false;
}
return true;
}
return false;
}
private void enrich() {
ItemStack[] output = inputTank.getTankType().getOutput();
this.progress = 0;
inputTank.setFill(inputTank.getFill() - inputTank.getTankType().getFluidConsumed());
outputTank.setFill(outputTank.getFill() + inputTank.getTankType().getFluidProduced());
for(byte i = 0; i < output.length + 2 && i < 3; i++) {
if(slots[i + 2] == null) {
slots[i + 2] = output[i].copy();
} else {
slots[i + 2].stackSize += output[i].stackSize;
}
}
}
private void attemptTransfer() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
TileEntity te = worldObj.getTileEntity(this.xCoord + dir.offsetX, this.yCoord, this.zCoord + dir.offsetZ);
if(te instanceof TileEntityMachineGasCent) {
TileEntityMachineGasCent gasCent = (TileEntityMachineGasCent) te;
if(gasCent.tank.getFill() == 0 && gasCent.tank.getTankType() == this.tank.getTankType()) {
if(gasCent.inputTank.getTankType() != this.outputTank.getTankType()) {
gasCent.inputTank.setTankType(this.inputTank.getTankType().getOutputFluid());
gasCent.outputTank.setTankType(this.inputTank.getTankType().getOutputFluid().getOutputFluid());
}
//whew boy, so many nested if statements! this calls for a celebration!
if(gasCent.inputTank.getFill() <= gasCent.inputTank.getMaxFill() && this.outputTank.getFill() > 0) {
int fill = gasCent.inputTank.getMaxFill() - gasCent.inputTank.getFill();
if(this.outputTank.getFill() >= fill) {
this.outputTank.setFill(this.outputTank.getFill() - fill);
gasCent.inputTank.setFill(gasCent.inputTank.getFill() + fill);
} else {
gasCent.inputTank.setFill(gasCent.inputTank.getFill() + this.outputTank.getFill());
this.outputTank.setFill(0);
}
}
}
}
}
public void networkUnpack(NBTTagCompound data) {
this.power = data.getLong("power");
this.progress = data.getInteger("progress");
}
@Override
public void updateEntity() {
@ -317,16 +315,64 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
}
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
//@Override
public void updatEntity() {
if(!worldObj.isRemote) {
this.updateStandardConnections(worldObj, xCoord, yCoord, zCoord);
power = Library.chargeTEFromItems(slots, 0, power, maxPower);
tank.setType(1, 1, slots);
if(inputTank.getTankType() == PseudoFluidType.PF6 || inputTank.getTankType() == PseudoFluidType.NUF6) {
tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
if(inputTank.getFill() <= inputTank.getMaxFill() && tank.getFill() > 0) {
int fill = inputTank.getMaxFill() - inputTank.getFill();
if(tank.getFill() >= fill) {
tank.setFill(tank.getFill() - fill);
inputTank.setFill(inputTank.getFill() + fill);
} else {
inputTank.setFill(inputTank.getFill() + tank.getFill());
tank.setFill(0);
}
}
}
if(canProcess()) {
isProgressing = true;
this.progress++;
this.power -= 200;
if(this.power < 0) {
power = 0;
this.progress = 0;
}
if(progress >= processingSpeed) {
process();
}
} else {
isProgressing = false;
this.progress = 0;
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("power", power);
data.setInteger("progress", progress);
this.networkPack(data, 50);
PacketDispatcher.wrapper.sendToAllAround(new AuxElectricityPacket(xCoord, yCoord, zCoord, power), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, progress, 0), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, isProgressing ? 1 : 0, 1), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
PacketDispatcher.wrapper.sendToAllAround(new LoopedSoundPacket(xCoord, yCoord, zCoord), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
}
}
@Override
@ -353,6 +399,13 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
@Override
public void setType(FluidType type, int index) {
tank.setTankType(type);
if(tank.getTankType() == FluidType.UF6) {
inputTank.setTankType(PseudoFluidType.NUF6);
outputTank.setTankType(PseudoFluidType.NUF6.getOutputFluid());
} else if(tank.getTankType() == FluidType.PUF6) {
inputTank.setTankType(PseudoFluidType.PF6);
outputTank.setTankType(PseudoFluidType.PF6.getOutputFluid());
}
}
@Override
@ -379,4 +432,116 @@ public class TileEntityMachineGasCent extends TileEntity implements ISidedInvent
return list;
}
@Override
public AxisAlignedBB getRenderBoundingBox() {
return TileEntity.INFINITE_EXTENT_AABB;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared()
{
return 65536.0D;
}
public class PseudoFluidTank {
PseudoFluidType type;
int fluid;
int maxFluid;
public PseudoFluidTank(PseudoFluidType type, int maxFluid) {
this.type = type;
this.maxFluid = maxFluid;
}
public void setFill(int i) {
fluid = i;
}
public void setTankType(PseudoFluidType type) {
if(this.type.name().equals(type.name()))
return;
this.type = type;
this.setFill(0);
}
public PseudoFluidType getTankType() {
return type;
}
public int getFill() {
return fluid;
}
public int getMaxFill() {
return maxFluid;
}
//Called by TE to save fillstate
public void writeToNBT(NBTTagCompound nbt, String s) {
nbt.setInteger(s, fluid);
nbt.setInteger(s + "_max", maxFluid);
nbt.setString(s + "_type", type.toString());
}
//Called by TE to load fillstate
public void readFromNBT(NBTTagCompound nbt, String s) {
fluid = nbt.getInteger(s);
int max = nbt.getInteger(s + "_max");
if(max > 0)
maxFluid = nbt.getInteger(s + "_max");
type = PseudoFluidType.valueOf(nbt.getString(s + "_type"));
}
/* ______ ______
* _I____I_ _I____I_
* / \\\ / \\\
* |IF{ || || } || |
* | IF{ || || } || |
* | IF{ || || } || |
* | IF{ || || } || |
* | IF{|| || } || |
* | || || || |
* | } || ||IF{ || |
* | } || || IF{ || |
* | } || || IF{ || |
* | } || || IF{ || |
* | } || || IF{|| |
* |IF{ || || } || |
* | IF{ || || } || |
* | IF{ || || } || |
* | IF{ || || } || |
* | IF{|| || } || |
* | || || || |
* | } || ||IF{ || |
* | } || || IF{ || |
* | } || || IF{ || |
* | } || || IF{ || |
* | } || || IF{|| |
* |IF{ || || } || |
* | IF{ || || } || |
* | IF{ || || } || |
* | IF{ || || } || |
* | IF{|| || } || |
* | || || || |
* | } || ||IF{ || |
* | } || || IF{ || |
* | } || || IF{ || |
* | } || || IF{ || |
* | } || || IF{|| |
* _|_______||_||_______||_|_
* | |
* | |
* | |==========| |
* | |NESTED | |
* | |IF (: | |
* | |STATEMENTS| |
* | |==========| |
* | |
* | |
* ----------------------------
*/
}
}