Search in sources :

Example 1 with PacketGetDestinationInfo

use of mcjty.rftools.dimension.network.PacketGetDestinationInfo in project RFTools by McJty.

the class MatterTransmitterBlock method addInformation.

@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack itemStack, EntityPlayer player, List list, boolean whatIsThis) {
    super.addInformation(itemStack, player, list, whatIsThis);
    NBTTagCompound tagCompound = itemStack.getTagCompound();
    if (tagCompound != null) {
        String name = tagCompound.getString("tpName");
        list.add(EnumChatFormatting.GREEN + "Name: " + name);
        boolean dialed = false;
        Coordinate c = Coordinate.readFromNBT(tagCompound, "dest");
        if (c != null && c.getY() >= 0) {
            dialed = true;
        } else if (tagCompound.hasKey("destId")) {
            if (tagCompound.getInteger("destId") != -1) {
                dialed = true;
            }
        }
        if (dialed) {
            int destId = tagCompound.getInteger("destId");
            if (System.currentTimeMillis() - lastTime > 500) {
                lastTime = System.currentTimeMillis();
                RFToolsMessages.INSTANCE.sendToServer(new PacketGetDestinationInfo(destId));
            }
            String destname = "?";
            if (ReturnDestinationInfoHelper.id != null && ReturnDestinationInfoHelper.id == destId) {
                destname = ReturnDestinationInfoHelper.name;
            }
            list.add(EnumChatFormatting.YELLOW + "[DIALED to " + destname + "]");
        }
        boolean once = tagCompound.getBoolean("once");
        if (once) {
            list.add(EnumChatFormatting.YELLOW + "[ONCE]");
        }
    }
    if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT)) {
        list.add(EnumChatFormatting.WHITE + "If you place this block near a Dialing Device then");
        list.add(EnumChatFormatting.WHITE + "you can dial it to a Matter Receiver. Make sure to give");
        list.add(EnumChatFormatting.WHITE + "it sufficient power!");
        list.add(EnumChatFormatting.WHITE + "Use a Destination Analyzer adjacent to this block");
        list.add(EnumChatFormatting.WHITE + "to check destination status (red is bad, green ok,");
        list.add(EnumChatFormatting.WHITE + "yellow is unknown).");
        list.add(EnumChatFormatting.WHITE + "Use a  Matter Booster adjacent to this block");
        list.add(EnumChatFormatting.WHITE + "to be able to teleport to unpowered receivers.");
        list.add(EnumChatFormatting.YELLOW + "Infusing bonus: reduced power consumption and");
        list.add(EnumChatFormatting.YELLOW + "increased teleportation speed.");
    } else {
        list.add(EnumChatFormatting.WHITE + RFTools.SHIFT_MESSAGE);
    }
}
Also used : PacketGetDestinationInfo(mcjty.rftools.dimension.network.PacketGetDestinationInfo) Coordinate(mcjty.lib.varia.Coordinate) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Example 2 with PacketGetDestinationInfo

use of mcjty.rftools.dimension.network.PacketGetDestinationInfo in project RFTools by McJty.

the class MatterTransmitterBlock method getWailaBody.

@SideOnly(Side.CLIENT)
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config) {
    super.getWailaBody(itemStack, currenttip, accessor, config);
    TileEntity te = accessor.getTileEntity();
    if (te instanceof MatterTransmitterTileEntity) {
        MatterTransmitterTileEntity matterTransmitterTileEntity = (MatterTransmitterTileEntity) te;
        currenttip.add(EnumChatFormatting.GREEN + "Name: " + matterTransmitterTileEntity.getName());
        if (matterTransmitterTileEntity.isDialed()) {
            if (System.currentTimeMillis() - lastTime > 500) {
                lastTime = System.currentTimeMillis();
                RFToolsMessages.INSTANCE.sendToServer(new PacketGetDestinationInfo(matterTransmitterTileEntity.getTeleportId()));
            }
            String name = "?";
            if (ReturnDestinationInfoHelper.id != null && ReturnDestinationInfoHelper.id == matterTransmitterTileEntity.getTeleportId()) {
                name = ReturnDestinationInfoHelper.name;
            }
            currenttip.add(EnumChatFormatting.YELLOW + "[DIALED to " + name + "]");
        }
        if (matterTransmitterTileEntity.isOnce()) {
            currenttip.add(EnumChatFormatting.YELLOW + "[ONCE]");
        }
    }
    return currenttip;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) PacketGetDestinationInfo(mcjty.rftools.dimension.network.PacketGetDestinationInfo) SideOnly(cpw.mods.fml.relauncher.SideOnly)

Aggregations

SideOnly (cpw.mods.fml.relauncher.SideOnly)2 PacketGetDestinationInfo (mcjty.rftools.dimension.network.PacketGetDestinationInfo)2 Coordinate (mcjty.lib.varia.Coordinate)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 TileEntity (net.minecraft.tileentity.TileEntity)1