Search in sources :

Example 6 with PacketTile

use of icbm.classic.lib.network.packet.PacketTile in project ICBM-Classic by BuiltBrokenModding.

the class TileRadarStation method getGUIPacket.

@Override
protected PacketTile getGUIPacket() {
    PacketTile packet = new PacketTile("gui", GUI_PACKET_ID, this);
    packet.write(alarmRange);
    packet.write(safetyRange);
    packet.write(getFrequency());
    packet.write(detectedEntities.size());
    if (detectedEntities.size() > 0) {
        for (Entity entity : detectedEntities) {
            if (entity != null && entity.isEntityAlive()) {
                packet.write(entity.getEntityId());
                int type = RadarObjectType.OTHER.ordinal();
                if (entity instanceof EntityMissile) {
                    type = isMissileGoingToHit((EntityMissile) entity) ? RadarObjectType.MISSILE_IMPACT.ordinal() : RadarObjectType.MISSILE.ordinal();
                }
                packet.write(type);
            } else {
                packet.write(-1);
                packet.write(0);
            }
        }
    }
    return packet;
}
Also used : Entity(net.minecraft.entity.Entity) TileEntity(net.minecraft.tileentity.TileEntity) PacketTile(icbm.classic.lib.network.packet.PacketTile) Point(icbm.classic.lib.transform.vector.Point) EntityMissile(icbm.classic.content.entity.missile.EntityMissile)

Aggregations

PacketTile (icbm.classic.lib.network.packet.PacketTile)6 Point (icbm.classic.lib.transform.vector.Point)2 Pos (icbm.classic.lib.transform.vector.Pos)2 EntityMissile (icbm.classic.content.entity.missile.EntityMissile)1 Entity (net.minecraft.entity.Entity)1 TileEntity (net.minecraft.tileentity.TileEntity)1