Search in sources :

Example 1 with SendFieldsToClient

use of com.Da_Technomancer.crossroads.API.packets.SendFieldsToClient in project Crossroads by Crossroads-Development.

the class EmeraldGoggleEffect method armorTick.

@Override
public void armorTick(World world, EntityPlayer player, ArrayList<String> chat, RayTraceResult ray) {
    if (ray != null) {
        TileEntity te = world.getTileEntity(ray.getBlockPos());
        if (te != null) {
            if (te.hasCapability(Capabilities.AXLE_HANDLER_CAPABILITY, ray.sideHit.getOpposite())) {
                IAxleHandler axle = te.getCapability(Capabilities.AXLE_HANDLER_CAPABILITY, ray.sideHit.getOpposite());
                chat.add("Speed: " + axle.getMotionData()[0]);
                chat.add("Energy: " + axle.getMotionData()[1]);
                chat.add("Power: " + axle.getMotionData()[2]);
                chat.add("I: " + axle.getPhysData()[1] + ", Rotation Ratio: " + axle.getRotationRatio());
            } else if (te.hasCapability(Capabilities.AXLE_HANDLER_CAPABILITY, ray.sideHit)) {
                IAxleHandler axle = te.getCapability(Capabilities.AXLE_HANDLER_CAPABILITY, ray.sideHit);
                chat.add("Speed: " + axle.getMotionData()[0]);
                chat.add("Energy: " + axle.getMotionData()[1]);
                chat.add("Power: " + axle.getMotionData()[2]);
                chat.add("I: " + axle.getPhysData()[1] + ", Rotation Ratio: " + axle.getRotationRatio());
            } else if (te.hasCapability(Capabilities.AXIS_HANDLER_CAPABILITY, null)) {
                chat.add("Total Energy: " + te.getCapability(Capabilities.AXIS_HANDLER_CAPABILITY, null).getTotalEnergy());
            }
            if (te instanceof IGoggleInfoTE) {
                ((IGoggleInfoTE) te).addInfo(chat, GoggleLenses.EMERALD, player, ray.sideHit);
            }
        }
    }
    if (world.getTotalWorldTime() % 5 == 1) {
        if (FieldWorldSavedData.get(world).fieldNodes.containsKey(MiscOp.getLongFromChunkPos(new ChunkPos(player.getPosition())))) {
            ModPackets.network.sendTo(new SendFieldsToClient(FieldWorldSavedData.get(world).fieldNodes.get(MiscOp.getLongFromChunkPos(new ChunkPos(player.getPosition())))[1], (byte) 1, MiscOp.getLongFromChunkPos(new ChunkPos(player.getPosition()))), (EntityPlayerMP) player);
        } else {
            ModPackets.network.sendTo(new SendFieldsToClient(new byte[1][1], (byte) -1, MiscOp.getLongFromChunkPos(new ChunkPos(player.getPosition()))), (EntityPlayerMP) player);
        }
    }
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) IAxleHandler(com.Da_Technomancer.crossroads.API.rotary.IAxleHandler) SendFieldsToClient(com.Da_Technomancer.crossroads.API.packets.SendFieldsToClient) ChunkPos(net.minecraft.util.math.ChunkPos)

Aggregations

SendFieldsToClient (com.Da_Technomancer.crossroads.API.packets.SendFieldsToClient)1 IAxleHandler (com.Da_Technomancer.crossroads.API.rotary.IAxleHandler)1 TileEntity (net.minecraft.tileentity.TileEntity)1 ChunkPos (net.minecraft.util.math.ChunkPos)1