mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
ported a few more machines to the new fluid API
This commit is contained in:
parent
c57031c5f0
commit
3fed1d8d8d
@ -11,6 +11,7 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
|||||||
|
|
||||||
import api.hbm.block.ILaserable;
|
import api.hbm.block.ILaserable;
|
||||||
import api.hbm.energy.IEnergyGenerator;
|
import api.hbm.energy.IEnergyGenerator;
|
||||||
|
import api.hbm.fluid.IFluidStandardReceiver;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
@ -20,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEnergyGenerator, IFluidAcceptor, ILaserable {
|
public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEnergyGenerator, IFluidAcceptor, ILaserable, IFluidStandardReceiver {
|
||||||
|
|
||||||
public long power;
|
public long power;
|
||||||
public long joules;
|
public long joules;
|
||||||
@ -42,6 +43,7 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
|
|||||||
if (!worldObj.isRemote) {
|
if (!worldObj.isRemote) {
|
||||||
|
|
||||||
tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId);
|
||||||
|
this.subscribeToAllAround(tank.getTankType(), this);
|
||||||
|
|
||||||
power = joules * 5000;
|
power = joules * 5000;
|
||||||
|
|
||||||
@ -163,4 +165,9 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn
|
|||||||
nbt.setLong("joules", joules);
|
nbt.setLong("joules", joules);
|
||||||
tank.writeToNBT(nbt, "tank");
|
tank.writeToNBT(nbt, "tank");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] { tank };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -17,6 +17,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.IFluidStandardTransceiver;
|
||||||
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;
|
||||||
@ -25,7 +26,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 TileEntityMachineTurbine extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator {
|
public class TileEntityMachineTurbine extends TileEntityLoadedBase implements ISidedInventory, IFluidContainer, IFluidAcceptor, IFluidSource, IEnergyGenerator, IFluidStandardTransceiver {
|
||||||
|
|
||||||
private ItemStack slots[];
|
private ItemStack slots[];
|
||||||
|
|
||||||
@ -221,6 +222,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
|||||||
age = 0;
|
age = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.subscribeToAllAround(tanks[0].getTankType(), this);
|
||||||
fillFluidInit(tanks[1].getTankType());
|
fillFluidInit(tanks[1].getTankType());
|
||||||
|
|
||||||
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS)
|
||||||
@ -252,6 +254,8 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
|||||||
power = maxPower;
|
power = maxPower;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.sendFluidToAll(tanks[1].getTankType(), this);
|
||||||
|
|
||||||
tanks[1].unloadTank(5, 6, slots);
|
tanks[1].unloadTank(5, 6, slots);
|
||||||
|
|
||||||
for(int i = 0; i < 2; i++)
|
for(int i = 0; i < 2; i++)
|
||||||
@ -349,4 +353,14 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS
|
|||||||
public void setPower(long i) {
|
public void setPower(long i) {
|
||||||
this.power = i;
|
this.power = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getSendingTanks() {
|
||||||
|
return new FluidTank[] { tanks[1] };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] { tanks[0] };
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -26,7 +26,9 @@ import com.hbm.items.machine.ItemZirnoxRod;
|
|||||||
import com.hbm.lib.Library;
|
import com.hbm.lib.Library;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
import com.hbm.util.fauxpointtwelve.DirPos;
|
||||||
|
|
||||||
|
import api.hbm.fluid.IFluidStandardTransceiver;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
@ -36,7 +38,7 @@ import net.minecraft.util.AxisAlignedBB;
|
|||||||
import net.minecraft.util.Vec3;
|
import net.minecraft.util.Vec3;
|
||||||
import net.minecraftforge.common.util.ForgeDirection;
|
import net.minecraftforge.common.util.ForgeDirection;
|
||||||
|
|
||||||
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IControlReceiver {
|
public class TileEntityReactorZirnox extends TileEntityMachineBase implements IFluidContainer, IFluidAcceptor, IFluidSource, IControlReceiver, IFluidStandardTransceiver {
|
||||||
|
|
||||||
public int heat;
|
public int heat;
|
||||||
public static final int maxHeat = 100000;
|
public static final int maxHeat = 100000;
|
||||||
@ -120,54 +122,30 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
|||||||
private int[] getNeighbouringSlots(int id) {
|
private int[] getNeighbouringSlots(int id) {
|
||||||
|
|
||||||
switch(id) {
|
switch(id) {
|
||||||
case 0:
|
case 0: return new int[] { 1, 7 };
|
||||||
return new int[] { 1, 7 };
|
case 1: return new int[] { 0, 2, 8 };
|
||||||
case 1:
|
case 2: return new int[] { 1, 9 };
|
||||||
return new int[] { 0, 2, 8 };
|
case 3: return new int[] { 4, 10 };
|
||||||
case 2:
|
case 4: return new int[] { 3, 5, 11 };
|
||||||
return new int[] { 1, 9 };
|
case 5: return new int[] { 4, 6, 12 };
|
||||||
case 3:
|
case 6: return new int[] { 5, 13 };
|
||||||
return new int[] { 4, 10 };
|
case 7: return new int[] { 0, 8, 14 };
|
||||||
case 4:
|
case 8: return new int[] { 1, 7, 9, 15 };
|
||||||
return new int[] { 3, 5, 11 };
|
case 9: return new int[] { 2, 8, 16};
|
||||||
case 5:
|
case 10: return new int[] { 3, 11, 17 };
|
||||||
return new int[] { 4, 6, 12 };
|
case 11: return new int[] { 4, 10, 12, 18 };
|
||||||
case 6:
|
case 12: return new int[] { 5, 11, 13, 19 };
|
||||||
return new int[] { 5, 13 };
|
case 13: return new int[] { 6, 12, 20 };
|
||||||
case 7:
|
case 14: return new int[] { 7, 15, 21 };
|
||||||
return new int[] { 0, 8, 14 };
|
case 15: return new int[] { 8, 14, 16, 22 };
|
||||||
case 8:
|
case 16: return new int[] { 9, 15, 23 };
|
||||||
return new int[] { 1, 7, 9, 15 };
|
case 17: return new int[] { 10, 18 };
|
||||||
case 9:
|
case 18: return new int[] { 11, 17, 19 };
|
||||||
return new int[] { 2, 8, 16};
|
case 19: return new int[] { 12, 18, 20 };
|
||||||
case 10:
|
case 20: return new int[] { 13, 19 };
|
||||||
return new int[] { 3, 11, 17 };
|
case 21: return new int[] { 14, 22 };
|
||||||
case 11:
|
case 22: return new int[] { 15, 21, 23 };
|
||||||
return new int[] { 4, 10, 12, 18 };
|
case 23: return new int[] { 16, 22 };
|
||||||
case 12:
|
|
||||||
return new int[] { 5, 11, 13, 19 };
|
|
||||||
case 13:
|
|
||||||
return new int[] { 6, 12, 20 };
|
|
||||||
case 14:
|
|
||||||
return new int[] { 7, 15, 21 };
|
|
||||||
case 15:
|
|
||||||
return new int[] { 8, 14, 16, 22 };
|
|
||||||
case 16:
|
|
||||||
return new int[] { 9, 15, 23 };
|
|
||||||
case 17:
|
|
||||||
return new int[] { 10, 18 };
|
|
||||||
case 18:
|
|
||||||
return new int[] { 11, 17, 19 };
|
|
||||||
case 19:
|
|
||||||
return new int[] { 12, 18, 20 };
|
|
||||||
case 20:
|
|
||||||
return new int[] { 13, 19 };
|
|
||||||
case 21:
|
|
||||||
return new int[] { 14, 22 };
|
|
||||||
case 22:
|
|
||||||
return new int[] { 15, 21, 23 };
|
|
||||||
case 23:
|
|
||||||
return new int[] { 16, 22 };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
@ -188,6 +166,10 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
|||||||
fillFluidInit(steam.getTankType());
|
fillFluidInit(steam.getTankType());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(worldObj.getTotalWorldTime() % 20 == 0) {
|
||||||
|
this.updateConnections();
|
||||||
|
}
|
||||||
|
|
||||||
carbonDioxide.loadTank(24, 26, slots);
|
carbonDioxide.loadTank(24, 26, slots);
|
||||||
water.loadTank(25, 27, slots);
|
water.loadTank(25, 27, slots);
|
||||||
|
|
||||||
@ -218,6 +200,10 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for(DirPos pos : getConPos()) {
|
||||||
|
this.sendFluid(steam.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
|
}
|
||||||
|
|
||||||
checkIfMeltdown();
|
checkIfMeltdown();
|
||||||
|
|
||||||
NBTTagCompound data = new NBTTagCompound();
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
@ -396,6 +382,25 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
|||||||
fillFluid(this.xCoord + rot.offsetX * -3, this.yCoord + 3, this.zCoord + rot.offsetZ * -3, getTact(), type);
|
fillFluid(this.xCoord + rot.offsetX * -3, this.yCoord + 3, this.zCoord + rot.offsetZ * -3, getTact(), type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void updateConnections() {
|
||||||
|
for(DirPos pos : getConPos()) {
|
||||||
|
this.trySubscribe(water.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
|
this.trySubscribe(carbonDioxide.getTankType(), worldObj, pos.getX(), pos.getY(), pos.getZ(), pos.getDir());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private DirPos[] getConPos() {
|
||||||
|
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata() - BlockDummyable.offset);
|
||||||
|
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
|
||||||
|
|
||||||
|
return new DirPos[] {
|
||||||
|
new DirPos(this.xCoord + rot.offsetX * 3, this.yCoord + 1, this.zCoord + rot.offsetZ * 3, rot),
|
||||||
|
new DirPos(this.xCoord + rot.offsetX * 3, this.yCoord + 3, this.zCoord + rot.offsetZ * 3, rot),
|
||||||
|
new DirPos(this.xCoord + rot.offsetX * -3, this.yCoord + 1, this.zCoord + rot.offsetZ * -3, rot.getOpposite()),
|
||||||
|
new DirPos(this.xCoord + rot.offsetX * -3, this.yCoord + 3, this.zCoord + rot.offsetZ * -3, rot.getOpposite())
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public boolean getTact() {
|
public boolean getTact() {
|
||||||
if(age >= 0 && age < 10) {
|
if(age >= 0 && age < 10) {
|
||||||
return true;
|
return true;
|
||||||
@ -496,4 +501,14 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF
|
|||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getSendingTanks() {
|
||||||
|
return new FluidTank[] { steam };
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public FluidTank[] getReceivingTanks() {
|
||||||
|
return new FluidTank[] { water, carbonDioxide };
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 237 B |
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo2.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo2.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 450 B |
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo3.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 253 B |
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo4.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo4.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 350 B |
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo5.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo5.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 576 B |
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo6.png
Normal file
BIN
src/main/resources/assets/hbm/textures/items/circuit_demo6.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 255 B |
Loading…
x
Reference in New Issue
Block a user