Search in sources :

Example 21 with ChatComponentTranslation

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

the class CommandSetGlobalVariable method processCommand.

@Override
public void processCommand(ICommandSender sender, String[] args) {
    if (args.length != 4)
        throw new WrongUsageException("command.deliverAmazon.args");
    String varName = args[0].startsWith("#") ? args[0].substring(1) : args[0];
    ChunkPosition newPos = new ChunkPosition(parseInt(sender, args[1]), parseInt(sender, args[2]), parseInt(sender, args[3]));
    GlobalVariableManager.getInstance().set(varName, newPos);
    sender.addChatMessage(new ChatComponentTranslation("command.setGlobalVariable.output", varName, newPos.chunkPosX, newPos.chunkPosY, newPos.chunkPosZ));
}
Also used : WrongUsageException(net.minecraft.command.WrongUsageException) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ChunkPosition(net.minecraft.world.ChunkPosition)

Example 22 with ChatComponentTranslation

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

the class ItemRemote method isAllowedToEdit.

private boolean isAllowedToEdit(EntityPlayer player, ItemStack remote) {
    NBTTagCompound tag = remote.getTagCompound();
    if (tag != null) {
        if (tag.hasKey("securityX")) {
            int x = tag.getInteger("securityX");
            int y = tag.getInteger("securityY");
            int z = tag.getInteger("securityZ");
            int dimensionId = tag.getInteger("securityDimension");
            WorldServer world = null;
            for (WorldServer w : MinecraftServer.getServer().worldServers) {
                if (w.provider.dimensionId == dimensionId) {
                    world = w;
                    break;
                }
            }
            if (world != null) {
                TileEntity te = world.getTileEntity(x, y, z);
                if (te instanceof TileEntitySecurityStation) {
                    boolean canAccess = ((TileEntitySecurityStation) te).doesAllowPlayer(player);
                    if (!canAccess) {
                        player.addChatComponentMessage(new ChatComponentTranslation("gui.remote.noEditRights", x, y, z));
                    }
                    return canAccess;
                }
            }
        }
    }
    return true;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) TileEntitySecurityStation(pneumaticCraft.common.tileentity.TileEntitySecurityStation) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) WorldServer(net.minecraft.world.WorldServer)

Example 23 with ChatComponentTranslation

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

the class ItemManometer method itemInteractionForEntity.

@Override
public boolean itemInteractionForEntity(ItemStack iStack, EntityPlayer player, EntityLivingBase entity) {
    if (!player.worldObj.isRemote) {
        if (entity instanceof IManoMeasurable) {
            if (((IPressurizable) iStack.getItem()).getPressure(iStack) > 0F) {
                List<String> curInfo = new ArrayList<String>();
                ((IManoMeasurable) entity).printManometerMessage(player, curInfo);
                if (curInfo.size() > 0) {
                    ((IPressurizable) iStack.getItem()).addAir(iStack, -30);
                    for (String s : curInfo) {
                        player.addChatComponentMessage(new ChatComponentTranslation(s));
                    }
                    return true;
                }
            } else {
                player.addChatComponentMessage(new ChatComponentTranslation(EnumChatFormatting.RED + "The Manometer doesn't have any charge!"));
            }
        }
    }
    return false;
}
Also used : IPressurizable(pneumaticCraft.api.item.IPressurizable) IManoMeasurable(pneumaticCraft.api.tileentity.IManoMeasurable) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ArrayList(java.util.ArrayList)

Example 24 with ChatComponentTranslation

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

the class DamageSourcePneumaticCraft method func_151519_b.

/**
 * Returns the message to be displayed on player death.
 */
@Override
public IChatComponent func_151519_b(EntityLivingBase par1EntityLivingBase) {
    String messageMeta = "";
    int messageNumber = par1EntityLivingBase.getRNG().nextInt(deathMessages) + 1;
    messageMeta = messageNumber + "";
    EntityLivingBase entitylivingbase1 = par1EntityLivingBase.func_94060_bK();
    String s = "death.attack." + damageType + messageMeta;
    String s1 = s + ".player";
    return entitylivingbase1 != null && StatCollector.canTranslate(s1) ? new ChatComponentTranslation(s1, new Object[] { par1EntityLivingBase.func_145748_c_(), entitylivingbase1.func_145748_c_() }) : new ChatComponentTranslation(s, new Object[] { par1EntityLivingBase.func_145748_c_() });
}
Also used : ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) EntityLivingBase(net.minecraft.entity.EntityLivingBase)

Example 25 with ChatComponentTranslation

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

the class GuiRemoteEditor method initGui.

@Override
public void initGui() {
    if (pastebinGui != null && pastebinGui.outputTag != null) {
        NBTTagCompound tag = remote.getTagCompound();
        if (tag == null) {
            tag = new NBTTagCompound();
            remote.setTagCompound(tag);
        }
        tag.setTag("actionWidgets", pastebinGui.outputTag.getTagList("main", 10));
    } else if (remoteLayout != null) {
        NBTTagCompound tag = remote.getTagCompound();
        if (tag == null) {
            tag = new NBTTagCompound();
            remote.setTagCompound(tag);
        }
        tag.setTag("actionWidgets", remoteLayout.toNBT(oldGuiLeft, oldGuiTop).getTagList("actionWidgets", 10));
    }
    if (invSearchGui != null && invSearchGui.getSearchStack() != null && invSearchGui.getSearchStack().getItem() == Itemss.remote) {
        if (ItemRemote.hasSameSecuritySettings(remote, invSearchGui.getSearchStack())) {
            remoteLayout = new RemoteLayout(invSearchGui.getSearchStack(), guiLeft, guiTop);
        } else {
            mc.thePlayer.addChatComponentMessage(new ChatComponentTranslation("gui.remote.differentSecuritySettings"));
        }
    }
    super.initGui();
    oldGuiLeft = guiLeft;
    oldGuiTop = guiTop;
    visibleSpawnWidgets.clear();
    visibleSpawnWidgets.add(new ActionWidgetCheckBox(new GuiCheckBox(-1, guiLeft + 200, guiTop + 10, 0xFF000000, I18n.format("remote.checkbox.name"))));
    visibleSpawnWidgets.add(new ActionWidgetLabel(new WidgetLabelVariable(guiLeft + 200, guiTop + 25, I18n.format("remote.label.name"))));
    visibleSpawnWidgets.add(new ActionWidgetButton(new GuiButtonSpecial(-1, guiLeft + 200, guiTop + 40, 50, 20, I18n.format("remote.button.name"))));
    visibleSpawnWidgets.add(new ActionWidgetDropdown(new WidgetComboBox(fontRendererObj, guiLeft + 200, guiTop + 70, 70, fontRendererObj.FONT_HEIGHT + 1).setFixedOptions()));
    for (ActionWidget actionWidget : visibleSpawnWidgets) {
        addWidget(actionWidget.getWidget());
    }
    GuiButtonSpecial importRemoteButton = new GuiButtonSpecial(0, guiLeft - 24, guiTop + 20, 20, 20, "");
    importRemoteButton.setTooltipText(I18n.format("gui.remote.button.importRemoteButton"));
    importRemoteButton.setRenderStacks(new ItemStack(Itemss.remote));
    buttonList.add(importRemoteButton);
    GuiButtonSpecial pastebinButton = new GuiButtonSpecial(1, guiLeft - 24, guiTop + 44, 20, 20, "");
    pastebinButton.setTooltipText(I18n.format("gui.remote.button.pastebinButton"));
    // pastebinButton.setRenderStacks(new ItemStack(Itemss.advancedPCB));
    pastebinButton.setRenderedIcon(Textures.GUI_PASTEBIN_ICON_LOCATION);
    buttonList.add(pastebinButton);
}
Also used : PacketUpdateRemoteLayout(pneumaticCraft.common.network.PacketUpdateRemoteLayout) RemoteLayout(pneumaticCraft.common.remote.RemoteLayout) ActionWidgetCheckBox(pneumaticCraft.common.remote.ActionWidgetCheckBox) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) ActionWidgetDropdown(pneumaticCraft.common.remote.ActionWidgetDropdown) ActionWidgetButton(pneumaticCraft.common.remote.ActionWidgetButton) ChatComponentTranslation(net.minecraft.util.ChatComponentTranslation) ActionWidgetLabel(pneumaticCraft.common.remote.ActionWidgetLabel) GuiCheckBox(pneumaticCraft.client.gui.widget.GuiCheckBox) ActionWidget(pneumaticCraft.common.remote.ActionWidget) ItemStack(net.minecraft.item.ItemStack) WidgetLabelVariable(pneumaticCraft.common.remote.WidgetLabelVariable) WidgetComboBox(pneumaticCraft.client.gui.widget.WidgetComboBox)

Aggregations

ChatComponentTranslation (net.minecraft.util.ChatComponentTranslation)77 ItemStack (net.minecraft.item.ItemStack)19 EntityPlayer (net.minecraft.entity.player.EntityPlayer)13 TileEntity (net.minecraft.tileentity.TileEntity)13 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)11 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 TrainPacket (club.nsdn.nyasamarailway.network.TrainPacket)3 TileEntityActuator (club.nsdn.nyasamatelecom.api.tileentity.TileEntityActuator)3 EntityItem (net.minecraft.entity.item.EntityItem)3 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)3 TileEntityRailSniffer (club.nsdn.nyasamarailway.tileblock.signal.TileEntityRailSniffer)2 TileEntityReceiver (club.nsdn.nyasamatelecom.api.tileentity.TileEntityReceiver)2 SubscribeEvent (cpw.mods.fml.common.eventhandler.SubscribeEvent)2 Side (cpw.mods.fml.relauncher.Side)2