Java 类net.minecraft.util.text.TextComponentTranslation 实例源码

项目:FullwidthPunctuationFix    文件:CommandDumpGlyphWidth.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    new Thread(() -> {
        try {
            byte[] dataToDump = FullwidthPunctuationFix.INSTANCE.getCharWidthData();
            File dest = new File(Minecraft.getMinecraft().getResourcePackRepository().getDirResourcepacks(), "autogen_glyph_width");
            if (!dest.exists() || !dest.isDirectory()) {
                dest.mkdir();
            }
            File dumpTargetDir = new File(dest, "assets/minecraft/font");
            if (!dumpTargetDir.exists() || !dumpTargetDir.isDirectory()) {
                dumpTargetDir.mkdirs();
            }
            File dumpTarget = new File(dumpTargetDir, "glyph_sizes.bin");
            FileUtils.writeByteArrayToFile(dumpTarget, dataToDump, false);
            File packMeta = new File(dest, "pack.mcmeta");
            FileUtils.writeStringToFile(packMeta, "{ \"pack\": { \"pack_format\": 2, \"description\": \"Auto-generated glyph width data\" } }", "UTF-8", false);
            sender.addChatMessage(new TextComponentTranslation("command.fwpf.dump.success"));
        } catch (Exception e) {
            sender.addChatMessage(new TextComponentTranslation("command.fwpf.dump.fail"));
        }
    }, "GlyphWidthDataExporter").start();
}
项目:MineCamera    文件:ItemTripod.java   
@Override
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
        EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

    if (!worldIn.isRemote) {
        if(!facing.equals(EnumFacing.UP)){
            playerIn.addChatComponentMessage(new TextComponentTranslation("chat.tripod.mustup"));
            return EnumActionResult.PASS;
        }
        Entity entity = new EntityTripod(worldIn);
        entity.setPositionAndUpdate(pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5);
        entity.rotationYaw = playerIn.rotationYaw;
        entity.rotationPitch = playerIn.rotationPitch;
        worldIn.spawnEntityInWorld(entity);
        // worldIn.updateEntities();
        stack.stackSize--;
        return EnumActionResult.SUCCESS;
    }
    return EnumActionResult.PASS;
}
项目:pnc-repressurized    文件:PacketAmadronTradeAdd.java   
@Override
public void handleServerSide(PacketAmadronTradeAdd message, EntityPlayer player) {
    AmadronOfferCustom offer = message.getOffer();
    offer.updatePlayerId();
    if (AmadronOfferManager.getInstance().hasOffer(offer.copy().invert())) {
        player.sendStatusMessage(new TextComponentTranslation("message.amadron.duplicateReversedOffer"), false);
    } else if (AmadronOfferManager.getInstance().addStaticOffer(offer)) {
        if (AmadronOfferSettings.notifyOfTradeAddition) NetworkHandler.sendToAll(message);
        try {
            AmadronOfferStaticConfig.INSTANCE.writeToFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    } else {
        player.sendStatusMessage(new TextComponentTranslation("message.amadron.duplicateOffer"), false);
    }
}
项目:Backmemed    文件:StatList.java   
private static void initStats()
{
    for (Item item : Item.REGISTRY)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = getItemName(item);

            if (s != null)
            {
                OBJECT_USE_STATS[i] = (new StatCrafting("stat.useItem.", s, new TextComponentTranslation("stat.useItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();

                if (!(item instanceof ItemBlock))
                {
                    USE_ITEM_STATS.add((StatCrafting)OBJECT_USE_STATS[i]);
                }
            }
        }
    }

    replaceAllSimilarBlocks(OBJECT_USE_STATS);
}
项目:pnc-repressurized    文件:ItemManometer.java   
@Override
public boolean itemInteractionForEntity(ItemStack iStack, EntityPlayer player, EntityLivingBase entity, EnumHand hand) {
    if (!player.world.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.sendStatusMessage(new TextComponentTranslation(s), false);
                    }
                    return true;
                }
            } else {
                player.sendStatusMessage(new TextComponentTranslation(TextFormatting.RED + "The Manometer doesn't have any charge!"), false);
            }
        }
    }
    return false;
}
项目:Backmemed    文件:StatList.java   
private static void initItemDepleteStats()
{
    for (Item item : Item.REGISTRY)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = getItemName(item);

            if (s != null && item.isDamageable())
            {
                OBJECT_BREAK_STATS[i] = (new StatCrafting("stat.breakItem.", s, new TextComponentTranslation("stat.breakItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(OBJECT_BREAK_STATS);
}
项目:CustomWorldGen    文件:EntitySelector.java   
private static <T extends Entity> boolean isEntityTypeValid(ICommandSender commandSender, Map<String, String> params)
{
    String s = getArgument(params, "type");
    s = s != null && s.startsWith("!") ? s.substring(1) : s;

    if (s != null && !EntityList.isStringValidEntityName(s))
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.entity.invalidType", new Object[] {s});
        textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
        commandSender.addChatMessage(textcomponenttranslation);
        return false;
    }
    else
    {
        return true;
    }
}
项目:Industrial-Foregoing    文件:PetrifiedFuelInfoPiece.java   
@Override
public void drawForegroundLayer(BasicTeslaGuiContainer container, int guiX, int guiY, int mouseX, int mouseY) {
    super.drawForegroundLayer(container, guiX, guiY, mouseX, mouseY);
    if (this.tile != null) {
        long timeLeft = 0;
        long generatingRate = 0;
        if (this.tile.getGeneratedPowerStored() > 0) {
            timeLeft = ((this.tile.getGeneratedPowerStored() / 2) / this.tile.getGeneratedPowerReleaseRate()) / 20;
            generatingRate = this.tile.getGeneratedPowerReleaseRate();
        }
        FontRenderer renderer = Minecraft.getMinecraft().fontRenderer;
        GlStateManager.pushMatrix();
        GlStateManager.translate(this.getLeft() + 2, this.getTop() + 2, 0);
        GlStateManager.scale(1, 1, 1);
        renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.burning").getFormattedText(), 4, 4, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + getFormatedTime(timeLeft * 1000), 8, (renderer.FONT_HEIGHT) + 5, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + new TextComponentTranslation("text.industrialforegoing.display.producing").getFormattedText(), 4, 2 * (renderer.FONT_HEIGHT) + 9, 0xFFFFFF);
        renderer.drawString(TextFormatting.DARK_GRAY + "" + generatingRate + " RF/tick", 8, 3 * (renderer.FONT_HEIGHT) + 10, 0xFFFFFF);
        GlStateManager.popMatrix();
    }
}
项目:harshencastle    文件:HarshenDimensionalGate.java   
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn,
        EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) 
{
    if(!worldIn.isRemote)
        if(((Boolean)state.getValue(ACTIVE)).booleanValue())
        {
            Boolean goHome = playerIn.dimension == DimensionPontus.DIMENSION_ID;
            if(playerIn instanceof EntityPlayerMP)
                if(goHome) 
                    HarshenUtils.transferPlayerToDimension((EntityPlayerMP) playerIn, 0, pos);
                else
                    HarshenUtils.transferPlayerToDimension((EntityPlayerMP) playerIn, DimensionPontus.DIMENSION_ID, pos, getStateFromMeta(3));
        }
        else
            playerIn.sendStatusMessage(new TextComponentTranslation("block.gate.reactivate"), true);
    return super.onBlockActivated(worldIn, pos, state, playerIn, hand, facing, hitX, hitY, hitZ);
}
项目:harshencastle    文件:HarshenDimensionalDoor.java   
@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) 
{
    if(player.capabilities.isCreativeMode)
    {
        super.onBlockHarvested(worldIn, pos, state, player);
        return;
    }
    player.attackEntityFrom(DamageSource.MAGIC, 21);
    if(!worldIn.isRemote)
    {
        player.sendMessage((ITextComponent) new TextComponentTranslation("message.broken"));
    }


}
项目:FirstAid    文件:DebugDamageCommand.java   
@Override
public void execute(@Nonnull MinecraftServer server, @Nonnull ICommandSender sender, @Nonnull String[] args) throws CommandException {
    if (!(sender instanceof EntityPlayer))
        throw new CommandException(getUsage(sender));
    if (args.length != 2 && args.length != 3)
        throw new CommandException("Missing arguments. Usage: " + getUsage(sender));
    try {
        EnumPlayerPart part = EnumPlayerPart.valueOf(args[0].toUpperCase(Locale.ENGLISH));
        float damage = Float.parseFloat(args[1]);
        boolean debuff = true;
        if (args.length == 3)
            debuff = Boolean.parseBoolean(args[2]);
        EntityPlayer player = (EntityPlayer) sender;
        AbstractPlayerDamageModel damageModel = PlayerDataManager.getDamageModel(player);
        damageModel.getFromEnum(part).damage(damage, player, debuff);
        FirstAid.NETWORKING.sendTo(new MessageReceiveDamage(part, damage, 0F), (EntityPlayerMP) player);
        if (damageModel.isDead(player)) {
            player.sendMessage(new TextComponentTranslation("death.attack.generic", player.getDisplayName()));
            CommonUtils.killPlayer(player, null);
        }
    } catch (RuntimeException e) {
        throw new CommandException(e.toString());
    }
}
项目:Backmemed    文件:BlockAnvil.java   
/**
 * Called by ItemBlocks just before a block is actually set in the world, to allow for adjustments to the
 * IBlockstate
 */
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer)
{
    EnumFacing enumfacing = placer.getHorizontalFacing().rotateY();

    try
    {
        return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer).withProperty(FACING, enumfacing).withProperty(DAMAGE, Integer.valueOf(meta >> 2));
    }
    catch (IllegalArgumentException var11)
    {
        if (!worldIn.isRemote)
        {
            LOGGER.warn(String.format("Invalid damage property for anvil at %s. Found %d, must be in [0, 1, 2]", new Object[] {pos, Integer.valueOf(meta >> 2)}));

            if (placer instanceof EntityPlayer)
            {
                placer.addChatMessage(new TextComponentTranslation("Invalid damage property. Please pick in [0, 1, 2]", new Object[0]));
            }
        }

        return super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, 0, placer).withProperty(FACING, enumfacing).withProperty(DAMAGE, Integer.valueOf(0));
    }
}
项目:Game-Stages    文件:CommandStageInfo.java   
@Override
public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {

    if (sender instanceof EntityPlayer) {

        String stages = PlayerDataHandler.getStageData((EntityPlayer) sender).getUnlockedStages().stream().map(Object::toString).collect(Collectors.joining(", ")).toString();

        if (stages.isEmpty()) {

            sender.sendMessage(new TextComponentTranslation("commands.gamestage.info.empty"));
            return;
        }

        if (((EntityPlayer) sender).getUniqueID().toString().equalsIgnoreCase(BIRTHDAY_BOY_UUID)) {
            stages += ", HAPPY BIRTHDAY!";
        }

        sender.sendMessage(new TextComponentString(stages));
    }
}
项目:CustomWorldGen    文件:CommandScoreboard.java   
protected void listObjectives(ICommandSender sender, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);
    Collection<ScoreObjective> collection = scoreboard.getScoreObjectives();

    if (collection.isEmpty())
    {
        throw new CommandException("commands.scoreboard.objectives.list.empty", new Object[0]);
    }
    else
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.scoreboard.objectives.list.count", new Object[] {Integer.valueOf(collection.size())});
        textcomponenttranslation.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation);

        for (ScoreObjective scoreobjective : collection)
        {
            sender.addChatMessage(new TextComponentTranslation("commands.scoreboard.objectives.list.entry", new Object[] {scoreobjective.getName(), scoreobjective.getDisplayName(), scoreobjective.getCriteria().getName()}));
        }
    }
}
项目:CustomWorldGen    文件:CommandSpreadPlayers.java   
private void spread(ICommandSender sender, List<Entity> p_110669_2_, CommandSpreadPlayers.Position pos, double spreadDistance, double maxRange, World worldIn, boolean respectTeams) throws CommandException
{
    Random random = new Random();
    double d0 = pos.x - maxRange;
    double d1 = pos.z - maxRange;
    double d2 = pos.x + maxRange;
    double d3 = pos.z + maxRange;
    CommandSpreadPlayers.Position[] acommandspreadplayers$position = this.createInitialPositions(random, respectTeams ? this.getNumberOfTeams(p_110669_2_) : p_110669_2_.size(), d0, d1, d2, d3);
    int i = this.spreadPositions(pos, spreadDistance, worldIn, random, d0, d1, d2, d3, acommandspreadplayers$position, respectTeams);
    double d4 = this.setPlayerPositions(p_110669_2_, worldIn, acommandspreadplayers$position, respectTeams);
    notifyCommandListener(sender, this, "commands.spreadplayers.success." + (respectTeams ? "teams" : "players"), new Object[] {Integer.valueOf(acommandspreadplayers$position.length), Double.valueOf(pos.x), Double.valueOf(pos.z)});

    if (acommandspreadplayers$position.length > 1)
    {
        sender.addChatMessage(new TextComponentTranslation("commands.spreadplayers.info." + (respectTeams ? "teams" : "players"), new Object[] {String.format("%.2f", new Object[]{Double.valueOf(d4)}), Integer.valueOf(i)}));
    }
}
项目:Game-Stages    文件:CommandAddStage.java   
@Override
public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {

    if (args.length == 2) {

        final EntityPlayer player = getPlayer(server, sender, args[0]);
        final String stageName = args[1];

        PlayerDataHandler.getStageData(player).unlockStage(stageName);

        if (player instanceof EntityPlayerMP) {
            GameStages.NETWORK.sendTo(new PacketStage(stageName, true), (EntityPlayerMP) player);
        }

        player.sendMessage(new TextComponentTranslation("commands.gamestage.add.target", stageName));

        if (player != sender) {
            sender.sendMessage(new TextComponentTranslation("commands.gamestage.add.sender", stageName, player.getDisplayNameString()));
        }
    }
    else {
        throw new WrongUsageException("commands.gamestage.add.usage", new Object[0]);
    }
}
项目:Backmemed    文件:EntityDamageSource.java   
/**
 * Gets the death message that is displayed when the player dies
 */
public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn)
{
    ItemStack itemstack = this.damageSourceEntity instanceof EntityLivingBase ? ((EntityLivingBase)this.damageSourceEntity).getHeldItemMainhand() : ItemStack.field_190927_a;
    String s = "death.attack." + this.damageType;
    String s1 = s + ".item";
    return !itemstack.func_190926_b() && itemstack.hasDisplayName() && I18n.canTranslate(s1) ? new TextComponentTranslation(s1, new Object[] {entityLivingBaseIn.getDisplayName(), this.damageSourceEntity.getDisplayName(), itemstack.getTextComponent()}): new TextComponentTranslation(s, new Object[] {entityLivingBaseIn.getDisplayName(), this.damageSourceEntity.getDisplayName()});
}
项目:MineCamera    文件:EventLoader.java   
@SubscribeEvent
public void entityInteract(EntityInteract event) {
    if (event.getEntityPlayer().getEntityData().hasKey("renderViewCamera")) {
        event.setCanceled(true);
        if (event.getSide().isClient() && event.getHand().equals(EnumHand.MAIN_HAND)
                && event.getItemStack() == null) {
            System.out.println("EntityInteract,HandType=" + event.getHand());
            ActiveTripod(Minecraft.getMinecraft().thePlayer.getName(),
                    ((EntityTripod) event.getWorld()
                            .getEntityByID(event.getEntityPlayer().getEntityData().getInteger("renderViewCamera")))
                                    .getDelay());
        }
        return;
    }
    if (event.getTarget() instanceof EntityTripod) {
        Entity target = ((PlayerInteractEvent.EntityInteract) event).getTarget();
        EntityPlayer player = event.getEntityPlayer();
        if (!player.isSneaking()) {
            if (player.inventory.armorInventory[3] != null
                    && player.inventory.armorInventory[3].getItem() instanceof ItemGlassesHelmet) {
                if (player.getEntityWorld().isRemote) {
                    // System.out.println("123");
                    Minecraft.getMinecraft().setRenderViewEntity(target);
                    Minecraft.getMinecraft().ingameGUI.setRecordPlaying(new TextComponentTranslation("chat.tripod.info"), false);
                }
                player.getEntityData().setInteger("renderViewCamera", target.getEntityId());
            }else if(!event.getWorld().isRemote&&event.getHand().equals(EnumHand.MAIN_HAND)){
                player.addChatComponentMessage(new TextComponentTranslation("chat.tripod.mustuseglass"));
            }
        } else {
            player.getEntityData().setInteger("usingGui", target.getEntityId());
            player.openGui(MineCamera.instance, GuiElementLoader.GUI_TRIPOD_CAMERA, target.getEntityWorld(),
                    (int) target.posX, (int) target.posY, (int) target.posZ);
        }
    }
}
项目:CustomWorldGen    文件:CommandScoreboard.java   
protected void listPlayers(ICommandSender sender, String[] p_184920_2_, int p_184920_3_, MinecraftServer server) throws CommandException
{
    Scoreboard scoreboard = this.getScoreboard(server);

    if (p_184920_2_.length > p_184920_3_)
    {
        String s = getEntityName(server, sender, p_184920_2_[p_184920_3_]);
        Map<ScoreObjective, Score> map = scoreboard.getObjectivesForEntity(s);
        sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, map.size());

        if (map.isEmpty())
        {
            throw new CommandException("commands.scoreboard.players.list.player.empty", new Object[] {s});
        }

        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.scoreboard.players.list.player.count", new Object[] {Integer.valueOf(map.size()), s});
        textcomponenttranslation.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation);

        for (Score score : map.values())
        {
            sender.addChatMessage(new TextComponentTranslation("commands.scoreboard.players.list.player.entry", new Object[] {Integer.valueOf(score.getScorePoints()), score.getObjective().getDisplayName(), score.getObjective().getName()}));
        }
    }
    else
    {
        Collection<String> collection = scoreboard.getObjectiveNames();
        sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, collection.size());

        if (collection.isEmpty())
        {
            throw new CommandException("commands.scoreboard.players.list.empty", new Object[0]);
        }

        TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation("commands.scoreboard.players.list.count", new Object[] {Integer.valueOf(collection.size())});
        textcomponenttranslation1.getStyle().setColor(TextFormatting.DARK_GREEN);
        sender.addChatMessage(textcomponenttranslation1);
        sender.addChatMessage(new TextComponentString(joinNiceString(collection.toArray())));
    }
}
项目:Game-Stages    文件:CommandMirrorStages.java   
@Override
public void execute (MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {

    if (args.length == 2) {

        final EntityPlayer originalPlayer = getPlayer(server, sender, args[0]);
        final EntityPlayer secondPlayer = getPlayer(server, sender, args[1]);

        if (originalPlayer instanceof EntityPlayerMP && secondPlayer instanceof EntityPlayerMP) {

            final IStageData originalData = PlayerDataHandler.getStageData(originalPlayer);
            final IStageData secondData = PlayerDataHandler.getStageData(secondPlayer);

            if (originalData != null && secondData != null) {
                for (final String stage : originalData.getUnlockedStages()) {

                    // Transfers stages
                    secondData.unlockStage(stage);

                    // Sends stage changes to the client
                    GameStages.NETWORK.sendTo(new PacketStage(stage, false), (EntityPlayerMP) secondPlayer);

                    // Sends update messages
                    secondPlayer.sendMessage(new TextComponentTranslation("commands.gamestage.add.target", stage));
                }
            }
        }
    }
    else {
        throw new WrongUsageException("commands.gamestage.mirror.usage", new Object[0]);
    }
}
项目:pnc-repressurized    文件:PacketAmadronTradeAdd.java   
@Override
public void handleClientSide(PacketAmadronTradeAdd message, EntityPlayer player) {
    if (AmadronOfferSettings.notifyOfTradeAddition)
        player.sendStatusMessage(new TextComponentTranslation("message.amadron.playerAddedTrade",
                message.getOffer().getVendor(),
                WidgetAmadronOffer.getStringForObject(message.getOffer().getOutput()),
                WidgetAmadronOffer.getStringForObject(message.getOffer().getInput())), false);
}
项目:Backmemed    文件:CommandGameMode.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length <= 0)
    {
        throw new WrongUsageException("commands.gamemode.usage", new Object[0]);
    }
    else
    {
        GameType gametype = this.getGameModeFromCommand(sender, args[0]);
        EntityPlayer entityplayer = args.length >= 2 ? getPlayer(server, sender, args[1]) : getCommandSenderAsPlayer(sender);
        entityplayer.setGameType(gametype);
        ITextComponent itextcomponent = new TextComponentTranslation("gameMode." + gametype.getName(), new Object[0]);

        if (sender.getEntityWorld().getGameRules().getBoolean("sendCommandFeedback"))
        {
            entityplayer.addChatMessage(new TextComponentTranslation("gameMode.changed", new Object[] {itextcomponent}));
        }

        if (entityplayer == sender)
        {
            notifyCommandListener(sender, this, 1, "commands.gamemode.success.self", new Object[] {itextcomponent});
        }
        else
        {
            notifyCommandListener(sender, this, 1, "commands.gamemode.success.other", new Object[] {entityplayer.getName(), itextcomponent});
        }
    }
}
项目:Thermionics    文件:ProbeDataSupport.java   
@Override
public void provideProbeData(List<IProbeData> data) {
    if (machine.hasCapability(Thermionics.CAPABILITY_HEATSTORAGE, null)) {
        addHeatData(machine.getCapability(Thermionics.CAPABILITY_HEATSTORAGE, null), data);
    }

    if (machine.hasCapability(CapabilityEnergy.ENERGY, null)) {
        addRFData(machine.getCapability(CapabilityEnergy.ENERGY, null), data);
    }

    if (machine.hasCapability(Thermionics.CAPABILITY_ROTARYPOWER_SUPPLY, null)) {
        addRotarySupplierData(machine.getCapability(Thermionics.CAPABILITY_ROTARYPOWER_SUPPLY, null), data);
    }

    if (machine instanceof IMachineProgress) {
        float progress = ((IMachineProgress)machine).getMachineProgress();
        data.add(new ProbeData()
                .withLabel(new TextComponentTranslation("thermionics.data.progress"))
                .withBar(0, (int)(progress*100), 100, UnitDictionary.PERCENT));
    }

    if (machine.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP)) {
        addInventoryData(machine.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP), data);
    }

    if (machine.hasCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.UP)) {
        addFluidData(machine.getCapability(CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY, EnumFacing.UP), data);
    }

    //data.add(new ProbeData("MEMES: 9001"));
}
项目:Backmemed    文件:CommandListPlayers.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    int i = server.getCurrentPlayerCount();
    sender.addChatMessage(new TextComponentTranslation("commands.players.list", new Object[] {Integer.valueOf(i), Integer.valueOf(server.getMaxPlayers())}));
    sender.addChatMessage(new TextComponentString(server.getPlayerList().getFormattedListOfPlayers(args.length > 0 && "uuids".equalsIgnoreCase(args[0]))));
    sender.setCommandStat(CommandResultStats.Type.QUERY_RESULT, i);
}
项目:Zombe-Modpack    文件:EntityPlayerMP.java   
public void displayGui(IInteractionObject guiOwner)
{
    if (guiOwner instanceof ILootContainer && ((ILootContainer)guiOwner).getLootTable() != null && this.isSpectator())
    {
        this.addChatComponentMessage((new TextComponentTranslation("container.spectatorCantOpen", new Object[0])).setStyle((new Style()).setColor(TextFormatting.RED)), true);
    }
    else
    {
        this.getNextWindowId();
        this.connection.sendPacket(new SPacketOpenWindow(this.currentWindowId, guiOwner.getGuiID(), guiOwner.getDisplayName()));
        this.openContainer = guiOwner.createContainer(this.inventory, this);
        this.openContainer.windowId = this.currentWindowId;
        this.openContainer.addListener(this);
    }
}
项目:Industrial-Foregoing    文件:BlackHoleTankBlock.java   
@Override
public List<String> getTooltip(ItemStack stack) {
    List<String> tooltip = super.getTooltip(stack);
    if (stack.hasTagCompound() && FluidRegistry.isFluidRegistered(stack.getTagCompound().getString("FluidName"))) {
        tooltip.add(new TextComponentTranslation("text.industrialforegoing.display.fluid").getUnformattedText() + " " + new TextComponentTranslation(FluidRegistry.getFluid(stack.getTagCompound().getString("FluidName")).getUnlocalizedName()).getUnformattedText());
        tooltip.add(new TextComponentTranslation("text.industrialforegoing.display.amount").getUnformattedText() + " " + stack.getTagCompound().getInteger("Amount"));
    }
    return tooltip;
}
项目:Backmemed    文件:StatList.java   
/**
 * Initializes statistics related to craftable items. Is only called after both block and item stats have been
 * initialized.
 */
private static void initCraftableStats()
{
    Set<Item> set = Sets.<Item>newHashSet();

    for (IRecipe irecipe : CraftingManager.getInstance().getRecipeList())
    {
        ItemStack itemstack = irecipe.getRecipeOutput();

        if (!itemstack.func_190926_b())
        {
            set.add(irecipe.getRecipeOutput().getItem());
        }
    }

    for (ItemStack itemstack1 : FurnaceRecipes.instance().getSmeltingList().values())
    {
        set.add(itemstack1.getItem());
    }

    for (Item item : set)
    {
        if (item != null)
        {
            int i = Item.getIdFromItem(item);
            String s = getItemName(item);

            if (s != null)
            {
                CRAFTS_STATS[i] = (new StatCrafting("stat.craftItem.", s, new TextComponentTranslation("stat.craftItem", new Object[] {(new ItemStack(item)).getTextComponent()}), item)).registerStat();
            }
        }
    }

    replaceAllSimilarBlocks(CRAFTS_STATS);
}
项目:CustomWorldGen    文件:NetHandlerPlayServer.java   
public void processRightClickBlock(CPacketPlayerTryUseItemOnBlock packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.playerEntity.getServerWorld());
    WorldServer worldserver = this.serverController.worldServerForDimension(this.playerEntity.dimension);
    EnumHand enumhand = packetIn.getHand();
    ItemStack itemstack = this.playerEntity.getHeldItem(enumhand);
    BlockPos blockpos = packetIn.getPos();
    EnumFacing enumfacing = packetIn.getDirection();
    this.playerEntity.markPlayerActive();

    if (blockpos.getY() < this.serverController.getBuildLimit() - 1 || enumfacing != EnumFacing.UP && blockpos.getY() < this.serverController.getBuildLimit())
    {
        double dist = playerEntity.interactionManager.getBlockReachDistance() + 3;
        dist *= dist;
        if (this.targetPos == null && this.playerEntity.getDistanceSq((double)blockpos.getX() + 0.5D, (double)blockpos.getY() + 0.5D, (double)blockpos.getZ() + 0.5D) < dist && !this.serverController.isBlockProtected(worldserver, blockpos, this.playerEntity) && worldserver.getWorldBorder().contains(blockpos))
        {
            this.playerEntity.interactionManager.processRightClickBlock(this.playerEntity, worldserver, itemstack, enumhand, blockpos, enumfacing, packetIn.getFacingX(), packetIn.getFacingY(), packetIn.getFacingZ());
        }
    }
    else
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("build.tooHigh", new Object[] {Integer.valueOf(this.serverController.getBuildLimit())});
        textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
        this.playerEntity.connection.sendPacket(new SPacketChat(textcomponenttranslation));
    }

    this.playerEntity.connection.sendPacket(new SPacketBlockChange(worldserver, blockpos));
    this.playerEntity.connection.sendPacket(new SPacketBlockChange(worldserver, blockpos.offset(enumfacing)));
    itemstack = this.playerEntity.getHeldItem(enumhand);

    if (itemstack != null && itemstack.stackSize == 0)
    {
        this.playerEntity.setHeldItem(enumhand, (ItemStack)null);
        net.minecraftforge.event.ForgeEventFactory.onPlayerDestroyItem(this.playerEntity, itemstack, enumhand);
    }
}
项目:CustomWorldGen    文件:RealmsConnect.java   
public void abort()
{
    this.aborted = true;

    if (this.connection != null && this.connection.isChannelOpen())
    {
        this.connection.closeChannel(new TextComponentTranslation("disconnect.genericReason", new Object[0]));
        this.connection.checkDisconnected();
    }
}
项目:CustomWorldGen    文件:CommandHandler.java   
protected boolean tryExecute(ICommandSender sender, String[] args, ICommand command, String input)
{
    try
    {
        command.execute(this.getServer(), sender, args);
        return true;
    }
    catch (WrongUsageException wrongusageexception)
    {
        TextComponentTranslation textcomponenttranslation2 = new TextComponentTranslation("commands.generic.usage", new Object[] {new TextComponentTranslation(wrongusageexception.getMessage(), wrongusageexception.getErrorObjects())});
        textcomponenttranslation2.getStyle().setColor(TextFormatting.RED);
        sender.addChatMessage(textcomponenttranslation2);
    }
    catch (CommandException commandexception)
    {
        TextComponentTranslation textcomponenttranslation1 = new TextComponentTranslation(commandexception.getMessage(), commandexception.getErrorObjects());
        textcomponenttranslation1.getStyle().setColor(TextFormatting.RED);
        sender.addChatMessage(textcomponenttranslation1);
    }
    catch (Throwable var9)
    {
        TextComponentTranslation textcomponenttranslation = new TextComponentTranslation("commands.generic.exception", new Object[0]);
        textcomponenttranslation.getStyle().setColor(TextFormatting.RED);
        sender.addChatMessage(textcomponenttranslation);
        LOGGER.warn("Couldn\'t process command: \'" + input + "\'", var9);
    }

    return false;
}
项目:Backmemed    文件:DemoWorldManager.java   
/**
 * Sends a message to the player reminding them that this is the demo version
 */
private void sendDemoReminder()
{
    if (this.demoEndedReminder > 100)
    {
        this.thisPlayerMP.addChatMessage(new TextComponentTranslation("demo.reminder", new Object[0]));
        this.demoEndedReminder = 0;
    }
}
项目:Industrial-Foregoing    文件:IFTooltipEvent.java   
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onTooltip(ItemTooltipEvent event) {
    if (Block.getBlockFromItem(event.getItemStack().getItem()) == Blocks.AIR) return;
    Block block = Block.getBlockFromItem(event.getItemStack().getItem());
    if (block instanceof IHasAdvancedTooltip && !((IHasAdvancedTooltip) block).getTooltip(event.getItemStack()).isEmpty()) {
        if (!GuiScreen.isShiftKeyDown()) {
            event.getToolTip().add(new TextComponentTranslation("text.industrialforegoing.tooltip.hold_shift").getFormattedText());
        } else {
            event.getToolTip().addAll(((IHasAdvancedTooltip) block).getTooltip(event.getItemStack()));
        }
    }
}
项目:rtap    文件:ModDeath.java   
public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn) {

       EntityLivingBase entitylivingbase = entityLivingBaseIn.getAttackingEntity();
       String s = "death.attack." + this.damageType;
       String s1 = s + ".player";
       return entitylivingbase != null && I18n.canTranslate(s1) ? new TextComponentTranslation(s1, new Object[] {entityLivingBaseIn.getDisplayName(), entitylivingbase.getDisplayName()}) : new TextComponentTranslation(s, new Object[] {entityLivingBaseIn.getDisplayName()});

}
项目:Bewitchment    文件:TileEntityTarotsTable.java   
public void read(@Nonnull ItemStack tarotDeck, @Nonnull EntityPlayer reader) {
    if (!reader.world.isRemote) {
        if (checkDeck(tarotDeck) && consumePower(READ_COST, false)) {
            reader.openGui(Bewitchment.instance, LibGui.TAROT.ordinal(), reader.world, pos.getX(), pos.getY(), pos.getZ());
            PacketHandler.HANDLER.sendTo(new TarotMessage(reader), (EntityPlayerMP) reader);
        } else {
            reader.sendStatusMessage(new TextComponentTranslation("item.tarots.error_reading"), true);
        }
    }
}
项目:Backmemed    文件:DamageSource.java   
/**
 * Gets the death message that is displayed when the player dies
 */
public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn)
{
    EntityLivingBase entitylivingbase = entityLivingBaseIn.getAttackingEntity();
    String s = "death.attack." + this.damageType;
    String s1 = s + ".player";
    return entitylivingbase != null && I18n.canTranslate(s1) ? new TextComponentTranslation(s1, new Object[] {entityLivingBaseIn.getDisplayName(), entitylivingbase.getDisplayName()}): new TextComponentTranslation(s, new Object[] {entityLivingBaseIn.getDisplayName()});
}
项目:Bewitchment    文件:ItemBrew.java   
@Override
public String getItemStackDisplayName(ItemStack stack) {
    if (NBTHelper.hasTag(stack, BrewUtils.BREW_NAME)) {
        TextComponentTranslation text = new TextComponentTranslation(NBTHelper.getString(stack, BrewUtils.BREW_NAME));
        return text.getFormattedText();
    }
    return super.getItemStackDisplayName(stack);
}
项目:harshencastle    文件:BaseHarshenBlockCastle.java   
@Override
public void onBlockHarvested(World worldIn, BlockPos pos, IBlockState state, EntityPlayer player) 
{
    if(player.capabilities.isCreativeMode)
    {
        super.onBlockHarvested(worldIn, pos, state, player);
        return;
    }
    player.attackEntityFrom(DamageSource.MAGIC, 21);
    if(!worldIn.isRemote)
    {
        player.sendMessage((ITextComponent) new TextComponentTranslation("message.broken"));
    }
}
项目:ModularMachinery    文件:CommandHand.java   
@Override
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException {
    EntityPlayerMP player = getCommandSenderAsPlayer(sender);
    ItemStack held = player.getHeldItemMainhand();
    if(held.isEmpty()) {
        held = player.getHeldItemOffhand();
    }
    if(held.isEmpty()) {
        player.sendMessage(new TextComponentTranslation("command.modularmachinery.hand.empty"));
        return;
    }
    Item i = held.getItem();
    StringBuilder sb = new StringBuilder();
    sb.append(i.getRegistryName().toString());
    if(i.getHasSubtypes()) {
        sb.append("@").append(held.getItemDamage());
    }
    NBTTagCompound cmp = held.serializeNBT();
    if(cmp.hasKey("tag")) {
        String json = NBTJsonSerializer.serializeNBT(cmp.getTag("tag"));
        if(!json.isEmpty()) {
            sb.append(" (with nbt: ").append(json).append(" )");
        }
    }

    String str = sb.toString();
    player.sendMessage(new TextComponentString(str));
    ModularMachinery.NET_CHANNEL.sendTo(new PktCopyToClipboard(str), player);

    int burn = TileEntityFurnace.getItemBurnTime(held);
    if(burn > 0) {
        player.sendMessage(new TextComponentString("Fuel BurnTime: " + burn));
    }
}
项目:harshencastle    文件:BaseEnabledConfig.java   
@Override
public void read() {
    for(T componant: allComponants)
    {
        if(!testIfLegit(componant))
        {
            continue;
        }
        Property property = config.get(CATEGORY, getComponantPathInConfig(componant), true);
        property.setComment(new TextComponentTranslation("config.isEnabled", getComponantCommentName(componant)).getUnformattedText());
        enabledMap.put(componant, property.getBoolean());
    }
}
项目:CustomWorldGen    文件:DamageSource.java   
/**
 * Gets the death message that is displayed when the player dies
 */
public ITextComponent getDeathMessage(EntityLivingBase entityLivingBaseIn)
{
    EntityLivingBase entitylivingbase = entityLivingBaseIn.getAttackingEntity();
    String s = "death.attack." + this.damageType;
    String s1 = s + ".player";
    return entitylivingbase != null && I18n.canTranslate(s1) ? new TextComponentTranslation(s1, new Object[] {entityLivingBaseIn.getDisplayName(), entitylivingbase.getDisplayName()}): new TextComponentTranslation(s, new Object[] {entityLivingBaseIn.getDisplayName()});
}