diff --git a/src/main/java/api/hbm/fluid/IFluidStandardTransceiver.java b/src/main/java/api/hbm/fluid/IFluidStandardTransceiver.java index ab9ff9816..63f82526f 100644 --- a/src/main/java/api/hbm/fluid/IFluidStandardTransceiver.java +++ b/src/main/java/api/hbm/fluid/IFluidStandardTransceiver.java @@ -7,8 +7,8 @@ import com.hbm.inventory.fluid.FluidType; * transceiver [trăn-sē′vər], noun * * 1. A transmitter and receiver housed together in a single unit and having some circuits in common, often for portable or mobile use. - * 2. A combinedradiotransmitter and receiver. - * 3. A device that performs transmitting and receivingfunctions, especially if using commoncomponents. + * 2. A combined radio transmitter and receiver. + * 3. A device that performs transmitting and receiving functions, especially if using common components. * * The American Heritage® Dictionary of the English Language, 5th Edition. * diff --git a/src/main/java/api/hbm/fluid/IFluidUser.java b/src/main/java/api/hbm/fluid/IFluidUser.java index 9c79cb70c..402b8ceb4 100644 --- a/src/main/java/api/hbm/fluid/IFluidUser.java +++ b/src/main/java/api/hbm/fluid/IFluidUser.java @@ -64,12 +64,20 @@ public interface IFluidUser extends IFluidConnector { public default long getTotalFluidForSend(FluidType type) { return 0; } public default void removeFluidForTransfer(FluidType type, long amount) { } + public default void subscribeToAllAround(FluidType type, TileEntity te) { + subscribeToAllAround(type, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord); + } + public default void subscribeToAllAround(FluidType type, World world, int x, int y, int z) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.trySubscribe(type, world, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, dir); } + public default void unsubscribeToAllAround(FluidType type, TileEntity te) { + unsubscribeToAllAround(type, te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord); + } + public default void unsubscribeToAllAround(FluidType type, World world, int x, int y, int z) { for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) diff --git a/src/main/java/com/hbm/inventory/FluidTank.java b/src/main/java/com/hbm/inventory/FluidTank.java index 32271f1f1..fe64aa718 100644 --- a/src/main/java/com/hbm/inventory/FluidTank.java +++ b/src/main/java/com/hbm/inventory/FluidTank.java @@ -233,12 +233,18 @@ public class FluidTank { } } - public void setType(int in, ItemStack[] slots) { - setType(in, in, slots); + public boolean setType(int in, ItemStack[] slots) { + return setType(in, in, slots); } - //Changes tank type - public void setType(int in, int out, ItemStack[] slots) { + /** + * Changes the tank type and returns true if successful + * @param in + * @param out + * @param slots + * @return + */ + public boolean setType(int in, int out, ItemStack[] slots) { if(slots[in] != null && slots[in].getItem() instanceof ItemFluidIdentifier) { @@ -248,6 +254,7 @@ public class FluidTank { if(type != newType) { type = newType; fluid = 0; + return true; } } else if(slots[out] == null) { @@ -257,9 +264,12 @@ public class FluidTank { slots[out] = slots[in].copy(); slots[in] = null; fluid = 0; + return true; } } } + + return false; } /** diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java b/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java index 21e1bc9b8..f47981b5c 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityCondenser.java @@ -11,12 +11,13 @@ import com.hbm.inventory.fluid.Fluids; import com.hbm.lib.Library; import com.hbm.main.ModEventHandler; +import api.hbm.fluid.IFluidStandardTransceiver; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.EnumSkyBlock; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, IFluidSource { +public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, IFluidSource, IFluidStandardTransceiver { public int age = 0; public FluidTank[] tanks; @@ -53,6 +54,9 @@ public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, I tanks[1].setFill(tanks[1].getFill() + convert); } + this.subscribeToAllAround(tanks[0].getTankType(), this); + this.sendFluidToAll(tanks[1].getTankType(), this); + fillFluidInit(tanks[1].getTankType()); } else { @@ -148,4 +152,14 @@ public class TileEntityCondenser extends TileEntity implements IFluidAcceptor, I public void clearFluidList(FluidType type) { list.clear(); } + + @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/TileEntityDeuteriumExtractor.java b/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java index da47131a8..33be2eabb 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumExtractor.java @@ -14,11 +14,13 @@ import com.hbm.packet.PacketDispatcher; import com.hbm.tileentity.TileEntityMachineBase; import api.hbm.energy.IEnergyUser; +import api.hbm.fluid.IFluidStandardTransceiver; import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; -public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implements IFluidAcceptor, IFluidSource, IEnergyUser { +public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implements IFluidAcceptor, IFluidSource, IEnergyUser, IFluidStandardTransceiver { public int age = 0; public long power = 0; @@ -61,8 +63,9 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen data.setLong("power", power); this.networkPack(data, 25); } - - + + this.subscribeToAllAround(tanks[0].getTankType(), this); + this.sendFluidToAll(tanks[1].getTankType(), this); if(power < 0) power = 0; @@ -196,4 +199,14 @@ public class TileEntityDeuteriumExtractor extends TileEntityMachineBase implemen public long getMaxPower() { return maxPower; } + + @Override + public FluidTank[] getSendingTanks() { + return new FluidTank[] {tanks [1]}; + } + + @Override + public FluidTank[] getReceivingTanks() { + return new FluidTank[] {tanks [0]}; + } } \ No newline at end of file diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumTower.java b/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumTower.java index 62b3f97f1..8df9cc3e5 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumTower.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityDeuteriumTower.java @@ -4,10 +4,13 @@ import com.hbm.blocks.BlockDummyable; import com.hbm.inventory.FluidTank; import com.hbm.inventory.fluid.FluidType; import com.hbm.inventory.fluid.Fluids; +import com.hbm.util.fauxpointtwelve.BlockPos; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; +import net.minecraft.tileentity.TileEntity; import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; import net.minecraftforge.common.util.ForgeDirection; public class TileEntityDeuteriumTower extends TileEntityDeuteriumExtractor { @@ -71,6 +74,27 @@ public class TileEntityDeuteriumTower extends TileEntityDeuteriumExtractor { } protected void updateConnections() { + + for(BlockPos pos : getConPos()) { + this.trySubscribe(worldObj, pos.getX(), pos.getY(), pos.getZ(), ForgeDirection.UNKNOWN); + } + } + + public void subscribeToAllAround(FluidType type, World world, int x, int y, int z) { + + for(BlockPos pos : getConPos()) { + this.trySubscribe(type, world, pos.getX(), pos.getY(), pos.getZ(), ForgeDirection.UNKNOWN); + } + } + + public void sendFluidToAll(FluidType type, TileEntity te) { + + for(BlockPos pos : getConPos()) { + this.sendFluid(type, worldObj, pos.getX(), pos.getY(), pos.getZ(), ForgeDirection.UNKNOWN); + } + } + + private BlockPos[] getConPos() { int offsetX = 0; int offsetZ = 0; @@ -85,14 +109,16 @@ public class TileEntityDeuteriumTower extends TileEntityDeuteriumExtractor { offsetZ = dir.offsetZ; } - this.trySubscribe(worldObj, this.xCoord + offsetX * 2, this.yCoord, this.zCoord - offsetZ * 1, ForgeDirection.UNKNOWN); //TODO: figure this one out without dying - this.trySubscribe(worldObj, this.xCoord + offsetX * 2, this.yCoord, this.zCoord - offsetZ * 0, ForgeDirection.UNKNOWN); - this.trySubscribe(worldObj, this.xCoord + offsetX * 1, this.yCoord, this.zCoord - offsetZ * 2, ForgeDirection.UNKNOWN); - this.trySubscribe(worldObj, this.xCoord + offsetX * 0, this.yCoord, this.zCoord - offsetZ * 2, ForgeDirection.UNKNOWN); - this.trySubscribe(worldObj, this.xCoord + offsetX * 1, this.yCoord, this.zCoord + offsetZ * 1, ForgeDirection.UNKNOWN); - this.trySubscribe(worldObj, this.xCoord + offsetX * 0, this.yCoord, this.zCoord + offsetZ * 1, ForgeDirection.UNKNOWN); - this.trySubscribe(worldObj, this.xCoord - offsetX * 1, this.yCoord, this.zCoord + offsetZ * 0, ForgeDirection.UNKNOWN); - this.trySubscribe(worldObj, this.xCoord - offsetX * 1, this.yCoord, this.zCoord - offsetZ * 1, ForgeDirection.UNKNOWN); + return new BlockPos[] { + new BlockPos(this.xCoord + offsetX * 2, this.yCoord, this.zCoord - offsetZ * 1), + new BlockPos(this.xCoord + offsetX * 2, this.yCoord, this.zCoord - offsetZ * 0), + new BlockPos(this.xCoord + offsetX * 1, this.yCoord, this.zCoord - offsetZ * 2), + new BlockPos(this.xCoord + offsetX * 0, this.yCoord, this.zCoord - offsetZ * 2), + new BlockPos(this.xCoord + offsetX * 1, this.yCoord, this.zCoord + offsetZ * 1), + new BlockPos(this.xCoord + offsetX * 0, this.yCoord, this.zCoord + offsetZ * 1), + new BlockPos(this.xCoord - offsetX * 1, this.yCoord, this.zCoord + offsetZ * 0), + new BlockPos(this.xCoord - offsetX * 1, this.yCoord, this.zCoord - offsetZ * 1) + }; } AxisAlignedBB bb = null; diff --git a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDiesel.java b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDiesel.java index 945e46afe..dc3ca8f13 100644 --- a/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDiesel.java +++ b/src/main/java/com/hbm/tileentity/machine/TileEntityMachineDiesel.java @@ -101,13 +101,14 @@ public class TileEntityMachineDiesel extends TileEntityMachineBase implements IE for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) this.sendPower(worldObj, xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir); - - this.subscribeToAllAround(Fluids.WATER, worldObj, xCoord, yCoord, zCoord); //Tank Management - tank.setType(3, 4, slots); + FluidType last = tank.getTankType(); + if(tank.setType(3, 4, slots)) this.unsubscribeToAllAround(last, this); tank.loadTank(0, 1, slots); tank.updateTank(xCoord, yCoord, zCoord, worldObj.provider.dimensionId); + + this.subscribeToAllAround(tank.getTankType(), this); FluidType type = tank.getTankType(); if(type == Fluids.NITAN) diff --git a/src/main/resources/assets/hbm/textures/blocks/deep_cobble.png b/src/main/resources/assets/hbm/textures/blocks/deep_cobble.png new file mode 100644 index 000000000..bf059e3cb Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/deep_cobble.png differ diff --git a/src/main/resources/assets/hbm/textures/blocks/deep_cobble_burning.png b/src/main/resources/assets/hbm/textures/blocks/deep_cobble_burning.png new file mode 100644 index 000000000..9c87700af Binary files /dev/null and b/src/main/resources/assets/hbm/textures/blocks/deep_cobble_burning.png differ