mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-19 03:49:31 +00:00
Start work on machines and fix some mistakes.
This commit is contained in:
1 parent
ec975567b2
commit
5f5e856ceb
30 files changed
+239
-199
No files matched your search
@@ -1,14 +1,22 @@
|
||||
package crazypants.util;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import crazypants.enderio.conduit.IConduitBundle;
|
||||
import crazypants.enderio.conduit.TileConduitBundle;
|
||||
import crazypants.enderio.conduit.liquid.ILiquidConduit;
|
||||
import crazypants.enderio.conduit.liquid.PacketFluidLevel;
|
||||
import crazypants.enderio.machine.generator.combustion.PacketCombustionTank;
|
||||
import crazypants.enderio.machine.generator.combustion.TileCombustionGenerator;
|
||||
import crazypants.enderio.machine.generator.stirling.PacketBurnTime;
|
||||
import crazypants.enderio.machine.generator.stirling.TileEntityStirlingGenerator;
|
||||
|
||||
/**
|
||||
* To avoid integrated server crashes when calling client-only methods
|
||||
*
|
||||
* @author Garrett Spicer-Davis
|
||||
*/
|
||||
public class ClientUtil
|
||||
@@ -16,15 +24,51 @@ 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)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (pkt.tc == null || !(tile instanceof IConduitBundle)) { return; }
|
||||
IConduitBundle bundle = (IConduitBundle) tile;
|
||||
ILiquidConduit con = bundle.getConduit(ILiquidConduit.class);
|
||||
if(con == null) {
|
||||
return;
|
||||
}
|
||||
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;
|
||||
double zOff = 0.5 + (rand.nextDouble() - 0.5) * 1.1;
|
||||
Minecraft.getMinecraft().theWorld.spawnParticle("portal", bc.x + xOff, bc.y + yOff, bc.z + zOff, (rand.nextDouble() - 0.5) * 1.5, -rand.nextDouble(), (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);
|
||||
|
||||
if (message.nbtRoot.hasKey("coolantTank"))
|
||||
{
|
||||
NBTTagCompound tankRoot = message.nbtRoot.getCompoundTag("coolantTank");
|
||||
tile.getCoolantTank().readFromNBT(tankRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
tile.getCoolantTank().setFluid(null);
|
||||
}
|
||||
if (message.nbtRoot.hasKey("fuelTank"))
|
||||
{
|
||||
NBTTagCompound tankRoot = message.nbtRoot.getCompoundTag("fuelTank");
|
||||
tile.getFuelTank().readFromNBT(tankRoot);
|
||||
}
|
||||
else
|
||||
{
|
||||
tile.getFuelTank().setFluid(null);
|
||||
}
|
||||
}
|
||||
|
||||
public static void setStirlingBurnTime(PacketBurnTime message, int x, int y, int z)
|
||||
{
|
||||
TileEntityStirlingGenerator tile = (TileEntityStirlingGenerator) Minecraft.getMinecraft().theWorld.getTileEntity(x, y, z);
|
||||
|
||||
tile.burnTime = message.burnTime;
|
||||
tile.totalBurnTime = message.totalBurnTime;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user