Package net.minecraft.util

Examples of net.minecraft.util.ChatComponentTranslation


    public String getFileExtension() {
        return ".csv";
    }

    public IChatComponent dumpMessage(File file) {
        return new ChatComponentTranslation("nei.options.tools.dump.dumped",
                translateN(name), "dumps/" + file.getName());
    }
View Full Code Here


        if(args.length > 0)
        {
            if(args[0].equalsIgnoreCase("help"))
            {
                //        <demorph|clear|morphtarget> [player] [force (true/false)]
                icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.demorph").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
                icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.clear").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
                icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.morphtarget").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
                icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.addtolist").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
                icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.removefromlist").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
            }
            else if(args[0].equalsIgnoreCase("demorph"))
            {
                EntityPlayerMP player;
                if(args.length > 1)
                {
                    player = PlayerSelector.matchOnePlayer(icommandsender, args[1]);
                }
                else
                {
                    player = getCommandSenderAsPlayer(icommandsender);
                }
                if (player == null)
                {
                    player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(args[1]);
                }
                if(player != null)
                {
                    if(EntityHelper.demorphPlayer(player))
                    {
                        func_152373_a(icommandsender, this, "morph.command.forcingDemorph", player.getCommandSenderName());
                    }
                    else
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.notInMorph", player.getCommandSenderName()));
                    }
                }
                else if(args.length > 2 && args[2].equalsIgnoreCase("true"))
                {
                    try
                    {
                        EntityPlayerMP player1 = new EntityPlayerMP(FMLCommonHandler.instance().getMinecraftServerInstance(), DimensionManager.getWorld(0), EntityHelperBase.getSimpleGameProfileFromName(args[1]), new ItemInWorldManager(DimensionManager.getWorld(0)));
                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().readPlayerDataFromFile(player1);
                        if(Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).hasKey("morphData"))
                        {
                            MorphState state = Morph.proxy.tickHandlerServer.getSelfState(DimensionManager.getWorld(0), player1);

                            MorphInfo info = new MorphInfo(args[1], state, state);
                            info.morphProgress = 80;
                            info.healthOffset = Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).getDouble("healthOffset");

                            Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).removeTag("morphData");

                            PacketHandler.sendToAll(Morph.channels, info.getMorphInfoAsPacket());

                            Morph.proxy.tickHandlerServer.setPlayerMorphInfo(player1, null);

                            func_152373_a(icommandsender, this, "morph.command.forcingDemorph", args[1]);

                            //Workaround to force save.
                            FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.add(player1);
                            FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().saveAllPlayerData();
                            FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.remove(player1);
                        }
                        else
                        {
                            icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.noMorphData", args[1]));
                        }
                    }
                    catch(Exception e)
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.cannotReadMorphData", args[1]));
                    }
                }
                else
                {
                    icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.notOnline", args[1]));
                }
            }
            else if(args[0].equalsIgnoreCase("clear"))
            {
                EntityPlayer player;
                if(args.length > 1)
                {
                    player = PlayerSelector.matchOnePlayer(icommandsender, args[1]);
                }
                else
                {
                    player = getCommandSenderAsPlayer(icommandsender);
                }
                if (player == null)
                {
                    player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(args[1]);
                }
                if(player != null)
                {
                    MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player);

                    MorphState state1;

                    MorphState state2 = Morph.proxy.tickHandlerServer.getSelfState(player.worldObj, player);

                    if(info != null)
                    {
                        state1 = info.nextState;
                        MorphInfo info2 = new MorphInfo(player.getCommandSenderName(), state1, state2);
                        info2.setMorphing(true);
                        info2.healthOffset = info.healthOffset;
                        info2.preMorphHealth = player.getHealth();

                        Morph.proxy.tickHandlerServer.setPlayerMorphInfo(player, info2);

                        PacketHandler.sendToAll(Morph.channels, info2.getMorphInfoAsPacket());

                        player.worldObj.playSoundAtEntity(player, "morph:morph", 1.0F, 1.0F);
                    }
                    Morph.proxy.tickHandlerServer.removeAllPlayerMorphsExcludingCurrentMorph(player);

                    MorphHandler.updatePlayerOfMorphStates((EntityPlayerMP)player, null, true);

                    func_152373_a(icommandsender, this, "morph.command.clearingMorphs", args[1]);
                }
                else
                {
                    try
                    {
                        EntityPlayerMP player1 = new EntityPlayerMP(FMLCommonHandler.instance().getMinecraftServerInstance(), DimensionManager.getWorld(0), EntityHelperBase.getSimpleGameProfileFromName(args[1]), new ItemInWorldManager(DimensionManager.getWorld(0)));
                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().readPlayerDataFromFile(player1);

                        if(Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).hasKey("morphData"))
                        {
                            MorphState state = Morph.proxy.tickHandlerServer.getSelfState(DimensionManager.getWorld(0), player1);

                            MorphInfo info = new MorphInfo(args[1], state, state);
                            info.morphProgress = 80;
                            info.healthOffset = Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).getDouble("healthOffset");

                            Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).removeTag("morphData");

                            PacketHandler.sendToAll(Morph.channels, info.getMorphInfoAsPacket());

                            Morph.proxy.tickHandlerServer.setPlayerMorphInfo(player1, null);
                        }
                        Morph.proxy.tickHandlerServer.removeAllPlayerMorphsExcludingCurrentMorph(player1);
                        if(Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).hasKey("morphStatesCount"))
                        {
                            Morph.proxy.tickHandlerServer.getMorphDataFromPlayer(player1).removeTag("morphStatesCount");
                        }
                        func_152373_a(icommandsender, this, "morph.command.clearingMorphs", args[1]);

                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.add(player1);
                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().saveAllPlayerData();
                        FMLCommonHandler.instance().getMinecraftServerInstance().getConfigurationManager().playerEntityList.remove(player1);
                    }
                    catch(Exception e)
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.failToClear", args[1]));
                    }
                }
            }
            else if(args[0].equalsIgnoreCase("morphtarget"))
            {
                EntityPlayerMP player;
                if(args.length > 1)
                {
                    player = PlayerSelector.matchOnePlayer(icommandsender, args[1]);
                }
                else
                {
                    player = getCommandSenderAsPlayer(icommandsender);
                }
                if (player == null)
                {
                    player = MinecraftServer.getServer().getConfigurationManager().func_152612_a(args[1]);
                }
                if(player != null)
                {
                    MovingObjectPosition mop = EntityHelper.getEntityLook(player, 4D, false, 1.0F);
                    if(mop != null && mop.entityHit != null && mop.entityHit instanceof EntityLivingBase)
                    {
                        EntityLivingBase living = (EntityLivingBase)mop.entityHit;

                        if(living instanceof EntityPlayerMP)
                        {
                            EntityPlayerMP player1 = (EntityPlayerMP)living;

                            MorphInfo info = Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player1);
                            if(info != null)
                            {
                                if(info.getMorphing())
                                {
                                    living = info.prevState.entInstance;
                                }
                                else
                                {
                                    living = info.nextState.entInstance;
                                }
                            }
                        }

                        if(!EntityHelper.morphPlayer(player, living, false, true))
                        {
                            icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.notLookingAtMorphable", player.getCommandSenderName()));
                        }
                        else
                        {
                            func_152373_a(icommandsender, this, "morph.command.forcingMorphTarget", player.getCommandSenderName());
                        }
                    }
                    else
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.notLookingAtMorphable", player.getCommandSenderName()));
                    }
                }
                else if(args.length > 1)
                {
                    icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.cannotFindPlayer", args[1]));
                }
            }
            else if(args[0].equalsIgnoreCase("addtolist"))
            {
                if(args.length == 1)
                {
                    icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.addtolist").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
                }
                else
                {
                    StringBuilder sb = new StringBuilder();
                    for(int i = 1; i < args.length; i++)
                    {
                        sb.append(args[i]);
                        if(i < args.length - 1)
                        {
                            sb.append(" ");
                        }
                    }
                    if(!Morph.playerList.contains(sb.toString().trim()))
                    {
                        func_152373_a(icommandsender, this, "morph.command.addingToBlackWhite", sb.toString().trim());
                        Morph.playerList.add(sb.toString().trim());

                        StringBuilder sb1 = new StringBuilder();
                        for(int i = 0; i < Morph.playerList.size(); i++)
                        {
                            sb1.append(Morph.playerList.get(i));
                            if(i < Morph.playerList.size() - 1)
                            {
                                sb1.append(", ");
                            }
                        }
                        Morph.config.get("blackwhitelistedPlayers").set(sb1.toString());
                        Morph.config.save();
                    }
                    else
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.alreadyInList"));
                    }
                }
            }
            else if(args[0].equalsIgnoreCase("removefromlist"))
            {
                if(args.length == 1)
                {
                    icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.removefromlist").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.GRAY)));
                }
                else
                {
                    StringBuilder sb = new StringBuilder();
                    for(int i = 1; i < args.length; i++)
                    {
                        sb.append(args[i]);
                        if(i < args.length - 1)
                        {
                            sb.append(" ");
                        }
                    }
                    if(Morph.playerList.contains(sb.toString().trim()))
                    {
                        func_152373_a(icommandsender, this, "morph.command.removingFromBlackWhite", sb.toString().trim());
                        Morph.playerList.remove(sb.toString().trim());

                        StringBuilder sb1 = new StringBuilder();
                        for(int i = 0; i < Morph.playerList.size(); i++)
                        {
                            sb1.append(Morph.playerList.get(i));
                            if(i < Morph.playerList.size() - 1)
                            {
                                sb1.append(", ");
                            }
                        }
                        Morph.config.get("blackwhitelistedPlayers").set(sb1.toString());
                        Morph.config.save();
                    }
                    else
                    {
                        icommandsender.addChatMessage(new ChatComponentTranslation("morph.command.notInList"));
                    }
                }
            }
        }
        else
View Full Code Here

        if(Morph.config.getSessionInt("canSleepMorphed") == 0)
        {
            if(FMLCommonHandler.instance().getEffectiveSide().isServer() && Morph.proxy.tickHandlerServer.getPlayerMorphInfo(player) != null)
            {
                event.result = stats;
                player.addChatMessage(new ChatComponentTranslation("morph.denySleep"));
            }
            else if(FMLCommonHandler.instance().getEffectiveSide().isClient() && Morph.proxy.tickHandlerClient.playerMorphInfo.containsKey(player.getCommandSenderName()))
            {
                event.result = stats;
            }
View Full Code Here

        if (!(var1 instanceof EntityPlayer))
            return;

        ItemStack item = ((EntityPlayer) var1).getHeldItem();
        if (item == null || !(item.getItem() instanceof ItemBlock) || ((ItemBlock) item.getItem()).field_150939_a == null) {
            ((EntityPlayer) var1).addChatComponentMessage(new ChatComponentTranslation("denseores.commandIdentify.invalid"));
            return;
        }

        var1.addChatMessage(new ChatComponentTranslation("denseores.commandIdentify.start", item.toString()));

        ItemBlock itemBlock = (ItemBlock) item.getItem();
        Block b = itemBlock.field_150939_a;
        int metadata = itemBlock.getMetadata(item.getItemDamage());


        boolean isUnusual = b.getRenderType() != 0;

        var1.addChatMessage(new ChatComponentTranslation("S:baseBlock=%s", GameData.getBlockRegistry().getNameForObject(b)));
        var1.addChatMessage(new ChatComponentTranslation("I:baseBlockMeta=%s", metadata));

        String j = null;
        boolean same = true;
        for (int i = 0; i < 6; i++) {
            IIcon icon = b.getIcon(i, metadata);
            if (icon != null) {
                if (j == null) {
                    isUnusual = isUnusual || icon.getClass() != TextureAtlasSprite.class;
                    j = icon.getIconName();
                } else if (!j.equals(icon.getIconName())) {
                    same = false;
                    break;
                }
            }
        }

        if (same) {
            if (j == null) {
                var1.addChatMessage(new ChatComponentTranslation("denseores.commandIdentify.invalidtexture"));
            } else {
                var1.addChatMessage(new ChatComponentTranslation("S:baseBlockTexture=%s", j));
            }
        } else {
            var1.addChatMessage(new ChatComponentTranslation("denseores.commandIdentify.multipleTextures"));
            for (int i = 0; i < 6; i++) {
                IIcon icon = b.getIcon(i, metadata);
                if (icon != null) {
                    isUnusual = isUnusual || icon.getClass() != TextureAtlasSprite.class;
                    var1.addChatMessage(new ChatComponentTranslation("%s: %s", ForgeDirection.getOrientation(i).toString(), icon.getIconName()));
                }
            }
        }


        if (isUnusual) {
            var1.addChatMessage(new ChatComponentTranslation("denseores.commandIdentify.obligitarydisclaimer"));
        }
    }
View Full Code Here

    private void doTurnOnTileEntityTracking(ICommandSender sender, int duration)
    {
        ForgeTimeTracker.tileEntityTrackingDuration = duration;
        ForgeTimeTracker.tileEntityTracking = true;
        sender.addChatMessage(new ChatComponentTranslation("commands.forge.tracking.te.enabled", duration));
    }
View Full Code Here

        {
            for (Integer dimId : DimensionManager.getIDs())
            {
                double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dimId)) * 1.0E-6D;
                double worldTPS = Math.min(1000.0/worldTickTime, 20);
                sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dimId), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
            }
            double meanTickTime = ForgeCommand.mean(this.getServer().tickTimeArray) * 1.0E-6D;
            double meanTPS = Math.min(1000.0/meanTickTime, 20);
            sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary","Overall", timeFormatter.format(meanTickTime), timeFormatter.format(meanTPS)));
        }
        else
        {
            double worldTickTime = ForgeCommand.mean(this.getServer().worldTickTimes.get(dim)) * 1.0E-6D;
            double worldTPS = Math.min(1000.0/worldTickTime, 20);
            sender.addChatMessage(new ChatComponentTranslation("commands.forge.tps.summary",String.format("Dim %d", dim), timeFormatter.format(worldTickTime), timeFormatter.format(worldTPS)));
        }
    }
View Full Code Here

  public void onBlockClicked(World world, int x, int y, int z, EntityPlayer player) {
    if (world.isRemote && player.isSneaking() && !ItemBackpack.canEquipBackpack(player) &&
        BetterStorage.globalConfig.getBoolean(GlobalConfig.enableHelpTooltips) &&
        (System.currentTimeMillis() > lastHelpMessage + 10 * 1000)) {
      boolean backpack = (ItemBackpack.getBackpack(player) != null);
      player.addChatMessage(new ChatComponentTranslation("tile.betterstorage.backpack.cantEquip." + (backpack ? "backpack" : "chestplate")));
      lastHelpMessage = System.currentTimeMillis();
    }
  }
View Full Code Here

            }
            else if ("MC|AdvCdm".equals(p_147349_1_.func_149559_c()))
            {
                if (!net.serverController.isCommandBlockEnabled())
                {
                    net.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.notEnabled", new Object[0]));
                }
                else if (PermissionsManager.checkPermission(net.playerEntity, "mc.cmdblocks") && net.playerEntity.capabilities.isCreativeMode)
                {
                    packetbuffer = new PacketBuffer(Unpooled.wrappedBuffer(p_147349_1_.func_149558_e()));

                    try
                    {
                        byte b0 = packetbuffer.readByte();
                        CommandBlockLogic commandblocklogic = null;

                        if (b0 == 0)
                        {
                            TileEntity tileentity = net.playerEntity.worldObj.getTileEntity(packetbuffer.readInt(), packetbuffer.readInt(), packetbuffer.readInt());

                            if (tileentity instanceof TileEntityCommandBlock)
                            {
                                commandblocklogic = ((TileEntityCommandBlock)tileentity).func_145993_a();
                            }
                        }
                        else if (b0 == 1)
                        {
                            Entity entity = net.playerEntity.worldObj.getEntityByID(packetbuffer.readInt());

                            if (entity instanceof EntityMinecartCommandBlock)
                            {
                                commandblocklogic = ((EntityMinecartCommandBlock)entity).func_145822_e();
                            }
                        }

                        String s1 = packetbuffer.readStringFromBuffer(packetbuffer.readableBytes());

                        if (commandblocklogic != null)
                        {
                            commandblocklogic.func_145752_a(s1);
                            commandblocklogic.func_145756_e();
                            net.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.setCommand.success", new Object[] {s1}));
                        }
                    }
                    catch (Exception exception1)
                    {
                        NetHandlerPlayServer.logger.error("Couldn\'t set command block", exception1);
                    }
                    finally
                    {
                        packetbuffer.release();
                    }
                }
                else
                {
                    net.playerEntity.addChatMessage(new ChatComponentTranslation("advMode.notAllowed", new Object[0]));
                }
            }
            else if ("MC|Beacon".equals(p_147349_1_.func_149559_c()))
            {
                if (net.playerEntity.openContainer instanceof ContainerBeacon)
View Full Code Here

        }
    }

    public static void permissionDeniedMessage(ICommandSender sender)
    {
        ChatComponentTranslation msg = new ChatComponentTranslation("commands.generic.permission", new Object[0]);
        msg.getChatStyle().setColor(EnumChatFormatting.RED);
        sender.addChatMessage(msg);
    }
View Full Code Here

        format = FunctionHelper.replaceAllIgnoreCase(format, "%message", message);
        // }

        // finally make it the chat line.
        // TODO: This is probably incorrect with regards to coloring
        event.component = new ChatComponentTranslation(format);

        if (ConfigChat.logchat && ModuleChat.chatLog != null)
        {
            ModuleChat.chatLog.printf(FunctionHelper.getCurrentDateString() + " " + FunctionHelper.getCurrentTimeString() + "[" + event.username + "] "
                    + event.message); // don't use event.line - it shows colour codes and everything
View Full Code Here

TOP

Related Classes of net.minecraft.util.ChatComponentTranslation

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.