Search in sources :

Example 76 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project PneumaticCraft by MineMaarten.

the class ItemManometer method onItemUseFirst.

/**
 * Callback for item usage. If the item does something special on right clicking, he will have one of those. Return
 * True if something happen and false if it don't. This is for ITEMS, not BLOCKS
 */
@Override
public boolean onItemUseFirst(ItemStack iStack, EntityPlayer player, World world, int x, int y, int z, int side, float par8, float par9, float par10) {
    if (world.isRemote)
        return false;
    if (((IPressurizable) iStack.getItem()).getPressure(iStack) > 0F) {
        TileEntity te = world.getTileEntity(x, y, z);
        IPneumaticMachine machine = ModInteractionUtils.getInstance().getMachine(te);
        List<IChatComponent> curInfo = new ArrayList<IChatComponent>();
        List<String> info = new ArrayList<String>();
        if (te instanceof IManoMeasurable) {
            ((IManoMeasurable) te).printManometerMessage(player, info);
        } else if (machine != null) {
            machine.getAirHandler().printManometerMessage(player, info);
        }
        for (String s : info) curInfo.add(new ChatComponentTranslation(s));
        if (te instanceof IHeatExchanger) {
            IHeatExchangerLogic exchanger = ((IHeatExchanger) te).getHeatExchangerLogic(ForgeDirection.getOrientation(side));
            if (exchanger != null) {
                curInfo.add(new ChatComponentTranslation("waila.temperature", (int) exchanger.getTemperature() - 273));
            } else {
                for (ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
                    exchanger = ((IHeatExchanger) te).getHeatExchangerLogic(d);
                    if (exchanger != null) {
                        curInfo.add(new ChatComponentTranslation("waila.temperature." + d.toString().toLowerCase(), (int) exchanger.getTemperature() - 273));
                    }
                }
            }
        }
        if (curInfo.size() > 0) {
            ((IPressurizable) iStack.getItem()).addAir(iStack, -30);
            for (IChatComponent s : curInfo) {
                player.addChatComponentMessage(s);
            }
            return true;
        }
    } else {
        player.addChatComponentMessage(new ChatComponentTranslation(EnumChatFormatting.RED + "The Manometer doesn't have any charge!"));
        return false;
    }
    return false;
}
Also used : IPressurizable(pneumaticCraft.api.item.IPressurizable) IManoMeasurable(pneumaticCraft.api.tileentity.IManoMeasurable) ArrayList(java.util.ArrayList) TileEntity(net.minecraft.tileentity.TileEntity) IHeatExchanger(pneumaticCraft.api.tileentity.IHeatExchanger) IPneumaticMachine(pneumaticCraft.api.tileentity.IPneumaticMachine) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) IChatComponent(net.minecraft.util.IChatComponent) ForgeDirection(net.minecraftforge.common.util.ForgeDirection) IHeatExchangerLogic(pneumaticCraft.api.IHeatExchangerLogic)

Example 77 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project PneumaticCraft by MineMaarten.

the class TileEntitySecurityStation method handleGUIButtonPress.

@Override
public void handleGUIButtonPress(int buttonID, EntityPlayer player) {
    if (buttonID == 0) {
        redstoneMode++;
        if (redstoneMode > 2)
            redstoneMode = 0;
        updateNeighbours();
    } else if (buttonID == 2) {
        rebootStation();
    } else if (buttonID == 3) {
        if (!hasValidNetwork()) {
            player.addChatComponentMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "This Security Station is out of order: Its network hasn't been properly configured."));
        } else {
            player.openGui(PneumaticCraft.instance, EnumGuiId.HACKING.ordinal(), worldObj, xCoord, yCoord, zCoord);
        }
    } else if (buttonID > 3 && buttonID - 4 < sharedUsers.size()) {
        sharedUsers.remove(buttonID - 4);
    }
    sendDescriptionPacket();
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation)

Example 78 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project PneumaticCraft by MineMaarten.

the class GuiHelmetMainOptions method keyTyped.

@Override
public void keyTyped(char ch, int key) {
    if (changingKeybinding) {
        changingKeybinding = false;
        updateKeybindingButtonText();
        KeyHandler.getInstance().keybindOpenOptions.setKeyCode(key);
        KeyBinding.resetKeyBindingArrayAndHash();
        FMLClientHandler.instance().getClient().thePlayer.addChatComponentMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Bound the opening of this menu to the '" + Keyboard.getKeyName(key) + "' key."));
    }
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation)

Example 79 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project PneumaticCraft by MineMaarten.

the class PacketAmadronTradeAdd method handleServerSide.

@Override
public void handleServerSide(PacketAmadronTradeAdd message, EntityPlayer player) {
    AmadronOfferCustom offer = message.getOffer();
    offer.updatePlayerId();
    if (AmadronOfferManager.getInstance().hasOffer(offer.copy().invert())) {
        player.addChatMessage(new ChatComponentTranslation("message.amadron.duplicateReversedOffer"));
    } else if (AmadronOfferManager.getInstance().addStaticOffer(offer)) {
        if (AmadronOfferSettings.notifyOfTradeAddition)
            NetworkHandler.sendToAll(message);
        try {
            AmadronOfferStaticConfig.INSTANCE.writeToFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else {
        player.addChatMessage(new ChatComponentTranslation("message.amadron.duplicateOffer"));
    }
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) IOException(java.io.IOException) AmadronOfferCustom(pneumaticCraft.common.recipes.AmadronOfferCustom)

Example 80 with ChatComponentTranslation

use of net.minecraft.util.ChatComponentTranslation in project PneumaticCraft by MineMaarten.

the class NetworkConnectionPlayerHandler method onSlotHack.

@Override
protected void onSlotHack(int slot, boolean nuked) {
    if (!nuked && gui instanceof GuiSecurityStationHacking) {
        ((GuiSecurityStationHacking) gui).onSlotHack(slot);
    }
    if (station.getStackInSlot(slot) != null && (station.getStackInSlot(slot).getItemDamage() == ItemNetworkComponents.NETWORK_REGISTRY || station.getStackInSlot(slot).getItemDamage() == ItemNetworkComponents.DIAGNOSTIC_SUBROUTINE)) {
        hackedSuccessfully = true;
        EntityPlayer player = FMLClientHandler.instance().getClient().thePlayer;
        NetworkHandler.sendToServer(new PacketSecurityStationAddHacker(station, player.getCommandSenderName()));
        FMLClientHandler.instance().getClient().thePlayer.closeScreen();
        player.addChatComponentMessage(new ChatComponentTranslation(EnumChatFormatting.GREEN + "Hacking successful! This Security Station now doesn't protect the area any longer!"));
        if (gui instanceof GuiSecurityStationHacking)
            ((GuiSecurityStationHacking) gui).removeUpdatesOnConnectionHandlers();
    }
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityPlayer(net.minecraft.entity.player.EntityPlayer) PacketSecurityStationAddHacker(pneumaticCraft.common.network.PacketSecurityStationAddHacker)

Aggregations

ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)89 ItemStack (net.minecraft.item.ItemStack)21 TileEntity (net.minecraft.tileentity.TileEntity)15 EntityPlayer (net.minecraft.entity.player.EntityPlayer)14 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)11 ChatComponentText (net.minecraft.util.ChatComponentText)6 ArrayList (java.util.ArrayList)5 Block (net.minecraft.block.Block)4 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)4 World (net.minecraft.world.World)4 Item1N4148 (club.nsdn.nyasamarailway.item.tool.Item1N4148)3 ItemNTP32Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP32Bit)3 ItemNTP8Bit (club.nsdn.nyasamarailway.item.tool.ItemNTP8Bit)3 TileEntityActuator (club.nsdn.nyasamatelecom.api.tileentity.TileEntityActuator)3 BufferedImage (java.awt.image.BufferedImage)3 IChatComponent (net.minecraft.util.IChatComponent)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 Int3 (WayofTime.alchemicalWizardry.api.Int3)2 TEReagentConduit (WayofTime.alchemicalWizardry.common.tileEntity.TEReagentConduit)2 TrainPacket (club.nsdn.nyasamarailway.network.TrainPacket)2