mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
a ton of new fluid API users
This commit is contained in:
parent
3b858df7ba
commit
f7bdf1d632
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.config.MobConfig;
|
import com.hbm.config.MobConfig;
|
||||||
import com.hbm.explosion.ExplosionNukeGeneric;
|
import com.hbm.explosion.ExplosionNukeGeneric;
|
||||||
@ -32,9 +33,9 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
import net.minecraft.util.AxisAlignedBB;
|
||||||
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityMachineReactorLarge extends TileEntity
|
public class TileEntityMachineReactorLarge extends TileEntity implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IFluidStandardTransceiver {
|
||||||
implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource {
|
|
||||||
|
|
||||||
private ItemStack slots[];
|
private ItemStack slots[];
|
||||||
|
|
||||||
@ -402,8 +403,7 @@ public class TileEntityMachineReactorLarge extends TileEntity
|
|||||||
age = 0;
|
age = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (age == 9 || age == 19)
|
fillFluidInit(tanks[2].getTankType());
|
||||||
fillFluidInit(tanks[2].getTankType());
|
|
||||||
|
|
||||||
caluclateSize();
|
caluclateSize();
|
||||||
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, size, 3), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
PacketDispatcher.wrapper.sendToAllAround(new AuxGaugePacket(xCoord, yCoord, zCoord, size, 3), new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 50));
|
||||||
@ -758,30 +758,27 @@ public class TileEntityMachineReactorLarge extends TileEntity
|
|||||||
@Override
|
@Override
|
||||||
public void fillFluidInit(FluidType type) {
|
public void fillFluidInit(FluidType type) {
|
||||||
|
|
||||||
if(worldObj.getBlock(xCoord - 2, yCoord, zCoord) == ModBlocks.reactor_hatch)
|
for(ForgeDirection dir : new ForgeDirection[] {Library.POS_X, Library.NEG_X, Library.POS_Z, Library.NEG_Z}) {
|
||||||
fillFluid(this.xCoord - 3, this.yCoord, this.zCoord, getTact(), type);
|
|
||||||
|
|
||||||
if(worldObj.getBlock(xCoord + 2, yCoord, zCoord) == ModBlocks.reactor_hatch)
|
if(worldObj.getBlock(xCoord + dir.offsetX * 2, yCoord, zCoord + dir.offsetZ * 2) == ModBlocks.reactor_hatch) {
|
||||||
fillFluid(this.xCoord + 3, this.yCoord, this.zCoord, getTact(), type);
|
fillFluid(this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3, getTact(), type);
|
||||||
|
for(int i = 0; i < 2; i++) this.trySubscribe(tanks[i].getTankType(), worldObj, this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3, Library.NEG_X);
|
||||||
if(worldObj.getBlock(xCoord, yCoord, zCoord - 2) == ModBlocks.reactor_hatch)
|
this.sendFluid(tanks[2].getTankType(), worldObj, this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3, Library.NEG_X);
|
||||||
fillFluid(this.xCoord, this.yCoord, this.zCoord - 3, getTact(), type);
|
} else {
|
||||||
|
for(int i = 0; i < 2; i++) this.tryUnsubscribe(tanks[i].getTankType(), worldObj, this.xCoord + dir.offsetX * 3, this.yCoord, this.zCoord + dir.offsetZ * 3);
|
||||||
if(worldObj.getBlock(xCoord, yCoord, zCoord + 2) == ModBlocks.reactor_hatch)
|
}
|
||||||
fillFluid(this.xCoord, this.yCoord, this.zCoord + 3, getTact(), type);
|
}
|
||||||
|
|
||||||
fillFluid(this.xCoord, this.yCoord + height + 1, this.zCoord, getTact(), type);
|
fillFluid(this.xCoord, this.yCoord + height + 1, this.zCoord, getTact(), type);
|
||||||
|
fillFluid(this.xCoord, this.yCoord - depth - 1, this.zCoord, getTact(), type);
|
||||||
|
|
||||||
fillFluid(this.xCoord, this.yCoord - depth - 1, this.zCoord + 3, getTact(), type);
|
this.sendFluid(tanks[2].getTankType(), worldObj, this.xCoord, this.yCoord + height + 1, this.zCoord, Library.POS_Y);
|
||||||
|
this.sendFluid(tanks[2].getTankType(), worldObj, this.xCoord, this.yCoord - depth - 1, this.zCoord, Library.NEG_Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean getTact() {
|
public boolean getTact() {
|
||||||
if (age >= 0 && age < 10) {
|
return this.worldObj.getTotalWorldTime() % 2 == 0;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -983,4 +980,19 @@ public class TileEntityMachineReactorLarge extends TileEntity
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getAllTanks() {
|
||||||
|
return tanks;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getSendingTanks() {
|
||||||
|
return new FluidTank[] {tanks[2]};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] {tanks[0], tanks[1]};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -24,6 +24,7 @@ import com.hbm.tileentity.TileEntityLoadedBase;
|
|||||||
|
|
||||||
import api.hbm.energy.IBatteryItem;
|
import api.hbm.energy.IBatteryItem;
|
||||||
import api.hbm.energy.IEnergyGenerator;
|
import api.hbm.energy.IEnergyGenerator;
|
||||||
|
import api.hbm.fluid.IFluidStandardReceiver;
|
||||||
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.ISidedInventory;
|
import net.minecraft.inventory.ISidedInventory;
|
||||||
@ -32,7 +33,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.nbt.NBTTagList;
|
import net.minecraft.nbt.NBTTagList;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityMachineSeleniumEngine extends TileEntityLoadedBase implements ISidedInventory, IEnergyGenerator, IFluidContainer, IFluidAcceptor, IConfigurableMachine {
|
public class TileEntityMachineSeleniumEngine extends TileEntityLoadedBase implements ISidedInventory, IEnergyGenerator, IFluidContainer, IFluidAcceptor, IFluidStandardReceiver, IConfigurableMachine {
|
||||||
|
|
||||||
private ItemStack slots[];
|
private ItemStack slots[];
|
||||||
|
|
||||||
@ -231,6 +232,7 @@ public class TileEntityMachineSeleniumEngine extends TileEntityLoadedBase implem
|
|||||||
|
|
||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
|
|
||||||
|
this.subscribeToAllAround(tank.getTankType(), this);
|
||||||
this.sendPower(worldObj, xCoord, yCoord - 1, zCoord, ForgeDirection.DOWN);
|
this.sendPower(worldObj, xCoord, yCoord - 1, zCoord, ForgeDirection.DOWN);
|
||||||
|
|
||||||
pistonCount = countPistons();
|
pistonCount = countPistons();
|
||||||
@ -401,4 +403,14 @@ public class TileEntityMachineSeleniumEngine extends TileEntityLoadedBase implem
|
|||||||
writer.endArray().setIndent(" ");
|
writer.endArray().setIndent(" ");
|
||||||
writer.name("B:shutUp").value(shutUp);
|
writer.name("B:shutUp").value(shutUp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getAllTanks() {
|
||||||
|
return new FluidTank[] {tank};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] {tank};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -45,11 +45,11 @@ public class TileEntityMachineRefinery extends TileEntityMachineBase implements
|
|||||||
public TileEntityMachineRefinery() {
|
public TileEntityMachineRefinery() {
|
||||||
super(12);
|
super(12);
|
||||||
tanks = new FluidTank[5];
|
tanks = new FluidTank[5];
|
||||||
tanks[0] = new FluidTank(Fluids.HOTOIL, 64000, 0);
|
tanks[0] = new FluidTank(Fluids.HOTOIL, 64_000, 0);
|
||||||
tanks[1] = new FluidTank(Fluids.HEAVYOIL, 16000, 1);
|
tanks[1] = new FluidTank(Fluids.HEAVYOIL, 24_000, 1);
|
||||||
tanks[2] = new FluidTank(Fluids.NAPHTHA, 16000, 2);
|
tanks[2] = new FluidTank(Fluids.NAPHTHA, 24_000, 2);
|
||||||
tanks[3] = new FluidTank(Fluids.LIGHTOIL, 16000, 3);
|
tanks[3] = new FluidTank(Fluids.LIGHTOIL, 24_000, 3);
|
||||||
tanks[4] = new FluidTank(Fluids.PETROLEUM, 16000, 4);
|
tanks[4] = new FluidTank(Fluids.PETROLEUM, 24_000, 4);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.tileentity.machine.rbmk;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import com.hbm.interfaces.IFluidAcceptor;
|
import com.hbm.interfaces.IFluidAcceptor;
|
||||||
import com.hbm.interfaces.IFluidSource;
|
import com.hbm.interfaces.IFluidSource;
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
@ -14,7 +15,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityHeatex extends TileEntity implements IFluidAcceptor, IFluidSource {
|
public class TileEntityHeatex extends TileEntity implements IFluidAcceptor, IFluidSource, IFluidStandardTransceiver {
|
||||||
|
|
||||||
public List<IFluidAcceptor> coolantList = new ArrayList();
|
public List<IFluidAcceptor> coolantList = new ArrayList();
|
||||||
public List<IFluidAcceptor> waterList = new ArrayList();
|
public List<IFluidAcceptor> waterList = new ArrayList();
|
||||||
@ -37,6 +38,11 @@ public class TileEntityHeatex extends TileEntity implements IFluidAcceptor, IFlu
|
|||||||
|
|
||||||
if(!worldObj.isRemote) {
|
if(!worldObj.isRemote) {
|
||||||
|
|
||||||
|
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||||
|
this.subscribeToAllAround(waterIn.getTankType(), this);
|
||||||
|
this.subscribeToAllAround(coolantIn.getTankType(), this);
|
||||||
|
}
|
||||||
|
|
||||||
/* Cool input */
|
/* Cool input */
|
||||||
double heatCap = maxHeat - heatBuffer;
|
double heatCap = maxHeat - heatBuffer;
|
||||||
int fillCap = coolantOut.getMaxFill() - coolantOut.getFill();
|
int fillCap = coolantOut.getMaxFill() - coolantOut.getFill();
|
||||||
@ -68,6 +74,9 @@ public class TileEntityHeatex extends TileEntity implements IFluidAcceptor, IFlu
|
|||||||
|
|
||||||
this.fillFluidInit(coolantOut.getTankType());
|
this.fillFluidInit(coolantOut.getTankType());
|
||||||
this.fillFluidInit(waterOut.getTankType());
|
this.fillFluidInit(waterOut.getTankType());
|
||||||
|
|
||||||
|
this.sendFluidToAll(waterOut.getTankType(), this);
|
||||||
|
this.sendFluidToAll(coolantOut.getTankType(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,4 +173,19 @@ public class TileEntityHeatex extends TileEntity implements IFluidAcceptor, IFlu
|
|||||||
if(type == waterIn.getTankType()) return waterIn.getMaxFill();
|
if(type == waterIn.getTankType()) return waterIn.getMaxFill();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getAllTanks() {
|
||||||
|
return new FluidTank[] {waterIn, waterOut, coolantIn, coolantOut};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getSendingTanks() {
|
||||||
|
return new FluidTank[] {waterOut, coolantOut};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] {waterIn, coolantIn};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.tileentity.machine.rbmk;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||||
import com.hbm.interfaces.IControlReceiver;
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
@ -13,12 +14,13 @@ import com.hbm.inventory.fluid.Fluids;
|
|||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||||
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
|
|
||||||
public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements IFluidAcceptor, IFluidSource, IControlReceiver {
|
public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements IFluidAcceptor, IFluidSource, IControlReceiver, IFluidStandardTransceiver {
|
||||||
|
|
||||||
public FluidTank feed;
|
public FluidTank feed;
|
||||||
public FluidTank steam;
|
public FluidTank steam;
|
||||||
@ -76,6 +78,11 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
fillFluidInit(steam.getTankType());
|
fillFluidInit(steam.getTankType());
|
||||||
|
|
||||||
|
this.trySubscribe(feed.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||||
|
for(DirPos pos : getOutputPos()) {
|
||||||
|
if(this.steam.getFill() > 0) this.sendFluid(steam.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
@ -122,6 +129,33 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DirPos[] getOutputPos() {
|
||||||
|
|
||||||
|
if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.rbmk_loader) {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y),
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord - 1, this.zCoord, Library.POS_X),
|
||||||
|
new DirPos(this.xCoord - 1, this.yCoord - 1, this.zCoord, Library.NEG_X),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 1, this.zCoord + 1, Library.POS_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 1, this.zCoord - 1, Library.NEG_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord, Library.NEG_Y)
|
||||||
|
};
|
||||||
|
} else if(worldObj.getBlock(xCoord, yCoord - 2, zCoord) == ModBlocks.rbmk_loader) {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y),
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord - 2, this.zCoord, Library.POS_X),
|
||||||
|
new DirPos(this.xCoord - 1, this.yCoord - 2, this.zCoord, Library.NEG_X),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord + 1, Library.POS_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord - 1, Library.NEG_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 3, this.zCoord, Library.NEG_Y)
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
|
public void fillFluid(int x, int y, int z, boolean newTact, FluidType type) {
|
||||||
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
|
Library.transmitFluid(x, y, z, newTact, this, worldObj, type);
|
||||||
@ -253,4 +287,19 @@ public class TileEntityRBMKBoiler extends TileEntityRBMKSlottedBase implements I
|
|||||||
data.setShort("type", (short)this.steam.getTankType().getID());
|
data.setShort("type", (short)this.steam.getTankType().getID());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getAllTanks() {
|
||||||
|
return new FluidTank[] {feed, steam};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getSendingTanks() {
|
||||||
|
return new FluidTank[] {steam};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] {feed};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.tileentity.machine.rbmk;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||||
import com.hbm.interfaces.IFluidAcceptor;
|
import com.hbm.interfaces.IFluidAcceptor;
|
||||||
@ -12,10 +13,11 @@ import com.hbm.inventory.fluid.Fluids;
|
|||||||
import com.hbm.inventory.fluid.tank.FluidTank;
|
import com.hbm.inventory.fluid.tank.FluidTank;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||||
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements IFluidAcceptor, IFluidSource {
|
public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements IFluidAcceptor, IFluidSource, IFluidStandardTransceiver {
|
||||||
|
|
||||||
public FluidTank feed;
|
public FluidTank feed;
|
||||||
public FluidTank steam;
|
public FluidTank steam;
|
||||||
@ -58,11 +60,43 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
|
|||||||
}
|
}
|
||||||
|
|
||||||
fillFluidInit(steam.getTankType());
|
fillFluidInit(steam.getTankType());
|
||||||
|
|
||||||
|
this.trySubscribe(feed.getTankType(), worldObj, xCoord, yCoord - 1, zCoord, Library.NEG_Y);
|
||||||
|
for(DirPos pos : getOutputPos()) {
|
||||||
|
if(this.steam.getFill() > 0) this.sendFluid(steam.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DirPos[] getOutputPos() {
|
||||||
|
|
||||||
|
if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.rbmk_loader) {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y),
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord - 1, this.zCoord, Library.POS_X),
|
||||||
|
new DirPos(this.xCoord - 1, this.yCoord - 1, this.zCoord, Library.NEG_X),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 1, this.zCoord + 1, Library.POS_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 1, this.zCoord - 1, Library.NEG_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord, Library.NEG_Y)
|
||||||
|
};
|
||||||
|
} else if(worldObj.getBlock(xCoord, yCoord - 2, zCoord) == ModBlocks.rbmk_loader) {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y),
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord - 2, this.zCoord, Library.POS_X),
|
||||||
|
new DirPos(this.xCoord - 1, this.yCoord - 2, this.zCoord, Library.NEG_X),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord + 1, Library.POS_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord - 1, Library.NEG_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 3, this.zCoord, Library.NEG_Y)
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static double getConversionHeat(FluidType type) {
|
public static double getConversionHeat(FluidType type) {
|
||||||
return getConversion(type).temperature;
|
return getConversion(type).temperature;
|
||||||
}
|
}
|
||||||
@ -210,4 +244,19 @@ public class TileEntityRBMKHeater extends TileEntityRBMKSlottedBase implements I
|
|||||||
data.setShort("hottype", (short)this.steam.getTankType().getID());
|
data.setShort("hottype", (short)this.steam.getTankType().getID());
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getAllTanks() {
|
||||||
|
return new FluidTank[] {feed, steam};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getSendingTanks() {
|
||||||
|
return new FluidTank[] {steam};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] {feed};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,6 @@
|
|||||||
package com.hbm.tileentity.machine.rbmk;
|
package com.hbm.tileentity.machine.rbmk;
|
||||||
|
|
||||||
|
import api.hbm.fluid.IFluidStandardReceiver;
|
||||||
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
||||||
import com.hbm.interfaces.IFluidAcceptor;
|
import com.hbm.interfaces.IFluidAcceptor;
|
||||||
import com.hbm.inventory.fluid.FluidType;
|
import com.hbm.inventory.fluid.FluidType;
|
||||||
@ -11,7 +12,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityRBMKInlet extends TileEntity implements IFluidAcceptor {
|
public class TileEntityRBMKInlet extends TileEntity implements IFluidAcceptor, IFluidStandardReceiver {
|
||||||
|
|
||||||
public FluidTank water;
|
public FluidTank water;
|
||||||
|
|
||||||
@ -28,6 +29,8 @@ public class TileEntityRBMKInlet extends TileEntity implements IFluidAcceptor {
|
|||||||
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
ForgeDirection dir = ForgeDirection.getOrientation(i);
|
||||||
Block b = worldObj.getBlock(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
Block b = worldObj.getBlock(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
||||||
|
|
||||||
|
this.trySubscribe(water.getTankType(), worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir);
|
||||||
|
|
||||||
if(b instanceof RBMKBase) {
|
if(b instanceof RBMKBase) {
|
||||||
int[] pos = ((RBMKBase)b).findCore(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
int[] pos = ((RBMKBase)b).findCore(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
|
||||||
|
|
||||||
@ -86,4 +89,14 @@ public class TileEntityRBMKInlet extends TileEntity implements IFluidAcceptor {
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getAllTanks() {
|
||||||
|
return new FluidTank[] {water};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] {water};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import java.util.ArrayList;
|
|||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import api.hbm.fluid.IFluidStandardSender;
|
||||||
import com.hbm.blocks.ModBlocks;
|
import com.hbm.blocks.ModBlocks;
|
||||||
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
import com.hbm.entity.projectile.EntityRBMKDebris.DebrisType;
|
||||||
import com.hbm.interfaces.IFluidAcceptor;
|
import com.hbm.interfaces.IFluidAcceptor;
|
||||||
@ -16,13 +17,14 @@ import com.hbm.items.ModItems;
|
|||||||
import com.hbm.items.machine.ItemFluidIcon;
|
import com.hbm.items.machine.ItemFluidIcon;
|
||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKConsole.ColumnType;
|
||||||
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
|
||||||
public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver, IFluidSource {
|
public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implements IRBMKFluxReceiver, IFluidSource, IFluidStandardSender {
|
||||||
|
|
||||||
public List<IFluidAcceptor> list = new ArrayList();
|
public List<IFluidAcceptor> list = new ArrayList();
|
||||||
public FluidTank gas;
|
public FluidTank gas;
|
||||||
@ -51,11 +53,41 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
|
|||||||
if(!canProcess()) {
|
if(!canProcess()) {
|
||||||
this.progress = 0;
|
this.progress = 0;
|
||||||
}
|
}
|
||||||
|
for(DirPos pos : getOutputPos()) {
|
||||||
|
if(this.gas.getFill() > 0) this.sendFluid(gas.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
super.updateEntity();
|
super.updateEntity();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected DirPos[] getOutputPos() {
|
||||||
|
|
||||||
|
if(worldObj.getBlock(xCoord, yCoord - 1, zCoord) == ModBlocks.rbmk_loader) {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y),
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord - 1, this.zCoord, Library.POS_X),
|
||||||
|
new DirPos(this.xCoord - 1, this.yCoord - 1, this.zCoord, Library.NEG_X),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 1, this.zCoord + 1, Library.POS_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 1, this.zCoord - 1, Library.NEG_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord, Library.NEG_Y)
|
||||||
|
};
|
||||||
|
} else if(worldObj.getBlock(xCoord, yCoord - 2, zCoord) == ModBlocks.rbmk_loader) {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y),
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord - 2, this.zCoord, Library.POS_X),
|
||||||
|
new DirPos(this.xCoord - 1, this.yCoord - 2, this.zCoord, Library.NEG_X),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord + 1, Library.POS_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 2, this.zCoord - 1, Library.NEG_Z),
|
||||||
|
new DirPos(this.xCoord, this.yCoord - 3, this.zCoord, Library.NEG_Y)
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + 1, this.yCoord + RBMKDials.getColumnHeight(worldObj) + 1, this.zCoord, Library.POS_Y)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void receiveFlux(NType type, double flux) {
|
public void receiveFlux(NType type, double flux) {
|
||||||
|
|
||||||
@ -280,4 +312,14 @@ public class TileEntityRBMKOutgasser extends TileEntityRBMKSlottedBase implement
|
|||||||
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
public int[] getAccessibleSlotsFromSide(int p_94128_1_) {
|
||||||
return new int[] {0, 1};
|
return new int[] {0, 1};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getAllTanks() {
|
||||||
|
return new FluidTank[] {gas};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getSendingTanks() {
|
||||||
|
return new FluidTank[] {gas};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package com.hbm.tileentity.machine.rbmk;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import api.hbm.fluid.IFluidStandardSender;
|
||||||
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
import com.hbm.blocks.machine.rbmk.RBMKBase;
|
||||||
import com.hbm.interfaces.IFluidAcceptor;
|
import com.hbm.interfaces.IFluidAcceptor;
|
||||||
import com.hbm.interfaces.IFluidSource;
|
import com.hbm.interfaces.IFluidSource;
|
||||||
@ -16,7 +17,7 @@ import net.minecraft.nbt.NBTTagCompound;
|
|||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityRBMKOutlet extends TileEntity implements IFluidSource {
|
public class TileEntityRBMKOutlet extends TileEntity implements IFluidSource, IFluidStandardSender {
|
||||||
|
|
||||||
public List<IFluidAcceptor> list = new ArrayList();
|
public List<IFluidAcceptor> list = new ArrayList();
|
||||||
public FluidTank steam;
|
public FluidTank steam;
|
||||||
@ -52,6 +53,7 @@ public class TileEntityRBMKOutlet extends TileEntity implements IFluidSource {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fillFluidInit(this.steam.getTankType());
|
fillFluidInit(this.steam.getTankType());
|
||||||
|
this.sendFluidToAll(steam.getTankType(), this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,4 +114,14 @@ public class TileEntityRBMKOutlet extends TileEntity implements IFluidSource {
|
|||||||
this.list.clear();
|
this.list.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getAllTanks() {
|
||||||
|
return new FluidTank[] {steam};
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getSendingTanks() {
|
||||||
|
return new FluidTank[] {steam};
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user