Added Gas Conduits

This commit is contained in:
Tonius committed 2014-08-24 15:12:37 +02:00
1 parent 18d4245c83
commit e8531024fa
90 files changed
+7058 -165

No files matched your search

+19 -4
View File
@@ -7,6 +7,8 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import crazypants.enderio.conduit.IConduitBundle;
import crazypants.enderio.conduit.TileConduitBundle;
import crazypants.enderio.conduit.gas.IGasConduit;
import crazypants.enderio.conduit.gas.PacketGasLevel;
import crazypants.enderio.conduit.liquid.ILiquidConduit;
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
import crazypants.enderio.machine.generator.combustion.PacketCombustionTank;
@@ -20,7 +22,7 @@ import crazypants.enderio.machine.generator.stirling.TileEntityStirlingGenerator
* @author Garrett Spicer-Davis
*/
public class ClientUtil {
public static void doFluidLevelUpdate(int x, int y, int z, PacketFluidLevel pkt) {
TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
if(pkt.tc == null || !(tile instanceof IConduitBundle)) {
@@ -34,6 +36,19 @@ public class ClientUtil {
con.readFromNBT(pkt.tc, TileConduitBundle.NBT_VERSION);
}
public static void doGasLevelUpdate(int x, int y, int z, PacketGasLevel pkt) {
TileEntity tile = Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
if(pkt.tc == null || !(tile instanceof IConduitBundle)) {
return;
}
IConduitBundle bundle = (IConduitBundle) tile;
IGasConduit con = bundle.getConduit(IGasConduit.class);
if(con == null) {
return;
}
con.readFromNBT(pkt.tc, TileConduitBundle.NBT_VERSION);
}
public static void spawnFarmParcticles(Random rand, BlockCoord bc) {
double xOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
double yOff = 0.5 + (rand.nextDouble() - 0.5) * 0.2;
@@ -42,13 +57,13 @@ public class ClientUtil {
(rand.nextDouble() - 0.5) * 1.5);
}
public static void setTankNBT(PacketCombustionTank message, int x, int y, int z) {
TileCombustionGenerator tile = (TileCombustionGenerator) Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
public static void setTankNBT(PacketCombustionTank message, int x, int y, int z) {
TileCombustionGenerator tile = (TileCombustionGenerator) Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
if(tile == null) {
//no loaded on client when receiving message, can happen when loading the chunks
return;
}
if(message.nbtRoot.hasKey("coolantTank")) {
NBTTagCompound tankRoot = message.nbtRoot.getCompoundTag("coolantTank");
tile.getCoolantTank().readFromNBT(tankRoot);