diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreReceiver.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreReceiver.java index dbe789d6e..ec5e842dd 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCoreReceiver.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCoreReceiver.java @@ -11,6 +11,7 @@ import com.hbm.tileentity.TileEntityMachineBase; import api.hbm.block.ILaserable; import api.hbm.energy.IEnergyGenerator; +import api.hbm.fluid.IFluidStandardReceiver; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.init.Blocks; @@ -20,7 +21,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; 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 joules; @@ -42,6 +43,7 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn if (!worldObj.isRemote) { tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); + this.subscribeToAllAround(tank.getTankType(), this); power = joules * 5000; @@ -163,4 +165,9 @@ public class TileEntityCoreReceiver extends TileEntityMachineBase implements IEn nbt.setLong("joules", joules); tank.writeToNBT(nbt, "tank"); } + + @Override + public FluidTank[] getReceivingTanks() { + return new FluidTank[] { tank }; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbine.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbine.java index 4acfb031a..d21369773 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbine.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineTurbine.java @@ -17,6 +17,7 @@ import com.hbm.tileentity.TileEntityLoadedBase; import api.hbm.energy.IBatteryItem; import api.hbm.energy.IEnergyGenerator; +import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.inventory.ISidedInventory; @@ -25,7 +26,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; 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[]; @@ -221,6 +222,7 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS age = 0; } + this.subscribeToAllAround(tanks[0].getTankType(), this); fillFluidInit(tanks[1].getTankType()); for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) @@ -252,6 +254,8 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS power = maxPower; } + this.sendFluidToAll(tanks[1].getTankType(), this); + tanks[1].unloadTank(5, 6, slots); for(int i = 0; i < 2; i++) @@ -349,4 +353,14 @@ public class TileEntityMachineTurbine extends TileEntityLoadedBase implements IS public void setPower(long i) { this.power = i; } + + @Override + public FluidTank[] getSendingTanks() { + return new FluidTank[] { tanks[1] }; + } + + @Override + public FluidTank[] getReceivingTanks() { + return new FluidTank[] { tanks[0] }; + } } diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityReactorZirnox.java b/src/main/java/com/hbm/tileentity/machine/TileEntityReactorZirnox.java index f5885f311..d48cacb7d 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityReactorZirnox.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityReactorZirnox.java @@ -26,7 +26,9 @@ import com.hbm.items.machine.ItemZirnoxRod; import com.hbm.lib.Library; import com.hbm.main.MainRegistry; 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.SideOnly; import net.minecraft.entity.player.EntityPlayer; @@ -36,7 +38,7 @@ import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.Vec3; 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 static final int maxHeat = 100000; @@ -120,54 +122,30 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF private int[] getNeighbouringSlots(int id) { switch(id) { - case 0: - return new int[] { 1, 7 }; - case 1: - return new int[] { 0, 2, 8 }; - case 2: - return new int[] { 1, 9 }; - case 3: - return new int[] { 4, 10 }; - case 4: - return new int[] { 3, 5, 11 }; - case 5: - return new int[] { 4, 6, 12 }; - case 6: - return new int[] { 5, 13 }; - case 7: - return new int[] { 0, 8, 14 }; - case 8: - return new int[] { 1, 7, 9, 15 }; - case 9: - return new int[] { 2, 8, 16}; - case 10: - return new int[] { 3, 11, 17 }; - case 11: - return new int[] { 4, 10, 12, 18 }; - 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 }; + case 0: return new int[] { 1, 7 }; + case 1: return new int[] { 0, 2, 8 }; + case 2: return new int[] { 1, 9 }; + case 3: return new int[] { 4, 10 }; + case 4: return new int[] { 3, 5, 11 }; + case 5: return new int[] { 4, 6, 12 }; + case 6: return new int[] { 5, 13 }; + case 7: return new int[] { 0, 8, 14 }; + case 8: return new int[] { 1, 7, 9, 15 }; + case 9: return new int[] { 2, 8, 16}; + case 10: return new int[] { 3, 11, 17 }; + case 11: return new int[] { 4, 10, 12, 18 }; + 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; @@ -187,6 +165,10 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF if(age == 9 || age == 19) { fillFluidInit(steam.getTankType()); } + + if(worldObj.getTotalWorldTime() % 20 == 0) { + this.updateConnections(); + } carbonDioxide.loadTank(24, 26, slots); water.loadTank(25, 27, slots); @@ -217,6 +199,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(); @@ -395,6 +381,25 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF fillFluid(this.xCoord + rot.offsetX * -3, this.yCoord + 1, 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() { if(age >= 0 && age < 10) { @@ -496,4 +501,14 @@ public class TileEntityReactorZirnox extends TileEntityMachineBase implements IF this.markDirty(); } + @Override + public FluidTank[] getSendingTanks() { + return new FluidTank[] { steam }; + } + + @Override + public FluidTank[] getReceivingTanks() { + return new FluidTank[] { water, carbonDioxide }; + } + } \ No newline at end of file diff --git a/src/main/resources/assets/hbm/textures/items/circuit_demo.png b/src/main/resources/assets/hbm/textures/items/circuit_demo.png new file mode 100644 index 000000000..bf2fda53f Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/circuit_demo.png differ diff --git a/src/main/resources/assets/hbm/textures/items/circuit_demo2.png b/src/main/resources/assets/hbm/textures/items/circuit_demo2.png new file mode 100644 index 000000000..bb8dc5ab3 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/circuit_demo2.png differ diff --git a/src/main/resources/assets/hbm/textures/items/circuit_demo3.png b/src/main/resources/assets/hbm/textures/items/circuit_demo3.png new file mode 100644 index 000000000..31d0830ff Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/circuit_demo3.png differ diff --git a/src/main/resources/assets/hbm/textures/items/circuit_demo4.png b/src/main/resources/assets/hbm/textures/items/circuit_demo4.png new file mode 100644 index 000000000..96d055865 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/circuit_demo4.png differ diff --git a/src/main/resources/assets/hbm/textures/items/circuit_demo5.png b/src/main/resources/assets/hbm/textures/items/circuit_demo5.png new file mode 100644 index 000000000..b2e7c5b4b Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/circuit_demo5.png differ diff --git a/src/main/resources/assets/hbm/textures/items/circuit_demo6.png b/src/main/resources/assets/hbm/textures/items/circuit_demo6.png new file mode 100644 index 000000000..2665167a3 Binary files /dev/null and b/src/main/resources/assets/hbm/textures/items/circuit_demo6.png differ