当前位置: 首页>>代码示例>>Java>>正文


Java GCCoreUtil.translateWithFormat方法代码示例

本文整理汇总了Java中micdoodle8.mods.galacticraft.core.util.GCCoreUtil.translateWithFormat方法的典型用法代码示例。如果您正苦于以下问题:Java GCCoreUtil.translateWithFormat方法的具体用法?Java GCCoreUtil.translateWithFormat怎么用?Java GCCoreUtil.translateWithFormat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在micdoodle8.mods.galacticraft.core.util.GCCoreUtil的用法示例。


在下文中一共展示了GCCoreUtil.translateWithFormat方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getSendingStatus

import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public String getSendingStatus()
{
    if (!this.addressValid)
    {
        return EnumColor.RED + GCCoreUtil.translate("gui.message.invalidTargetAddress.name");
    }

    if (this.targetAddressResult == TileEntityShortRangeTelepad.EnumTelepadSearchResult.TOO_FAR)
    {
        return EnumColor.RED + GCCoreUtil.translateWithFormat("gui.message.telepadTooFar.name", TELEPORTER_RANGE);
    }

    if (this.targetAddressResult == TileEntityShortRangeTelepad.EnumTelepadSearchResult.WRONG_DIM)
    {
        return EnumColor.RED + GCCoreUtil.translate("gui.message.telepadWrongDim.name");
    }

    if (this.targetAddressResult == TileEntityShortRangeTelepad.EnumTelepadSearchResult.NOT_FOUND)
    {
        return EnumColor.RED + GCCoreUtil.translate("gui.message.telepadNotFound.name");
    }

    if (this.getEnergyStoredGC() <= 0.0F)
    {
        return EnumColor.RED + GCCoreUtil.translate("gui.message.noEnergy.name");
    }

    if (this.getEnergyStoredGC() <= ENERGY_USE_ON_TELEPORT)
    {
        return EnumColor.RED + GCCoreUtil.translate("gui.message.notEnoughEnergy.name");
    }

    if (this.getDisabled(0))
    {
        return EnumColor.ORANGE + GCCoreUtil.translate("gui.status.disabled.name");
    }

    return EnumColor.BRIGHT_GREEN + GCCoreUtil.translate("gui.message.sendingActive.name");
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:41,代码来源:TileEntityShortRangeTelepad.java

示例2: drawScreen

import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; //导入方法依赖的package包/类
@Override
public void drawScreen(int par1, int par2, float par3)
{
    final int var5 = (this.width - this.xSize) / 2;
    final int var6 = (this.height - this.ySize) / 2;

    this.mc.renderEngine.bindTexture(GuiAirLockController.airLockControllerGui);
    this.drawTexturedModalRect(var5, var6, 0, 0, this.xSize, this.ySize);

    this.drawTexturedModalRect(var5 + 15, var6 + 51, 176, 0, 7, 9);

    String displayString = GCCoreUtil.translateWithFormat("gui.title.airLock.name", this.controller.ownerName);
    this.fontRendererObj.drawString(displayString, this.width / 2 - this.fontRendererObj.getStringWidth(displayString) / 2, this.height / 2 - 65, 4210752);

    if (this.cannotEditTimer > 0)
    {
        this.fontRendererObj.drawString(this.controller.ownerName, this.width / 2 - this.fontRendererObj.getStringWidth(displayString) / 2, this.height / 2 - 65, this.cannotEditTimer % 30 < 15 ? ColorUtil.to32BitColor(255, 255, 100, 100) : 4210752);
        this.cannotEditTimer--;
    }

    displayString = GCCoreUtil.translate("gui.message.status.name") + ":";
    this.fontRendererObj.drawString(displayString, this.width / 2 - this.fontRendererObj.getStringWidth(displayString) / 2, this.height / 2 + 45, 4210752);
    displayString = EnumColor.RED + GCCoreUtil.translate("gui.status.airLockClosed.name");

    if (!this.controller.active)
    {
        displayString = EnumColor.BRIGHT_GREEN + GCCoreUtil.translate("gui.status.airLockOpen.name");
    }

    this.fontRendererObj.drawString(displayString, this.width / 2 - this.fontRendererObj.getStringWidth(displayString) / 2, this.height / 2 + 55, 4210752);

    super.drawScreen(par1, par2, par3);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:34,代码来源:GuiAirLockController.java

示例3: processCommand

import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; //导入方法依赖的package包/类
@Override
public void processCommand(ICommandSender icommandsender, String[] astring)
{
    EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayerUsername(icommandsender.getCommandSenderName(), true);

    if (astring.length == 0)
    {
        try
        {
            if (playerBase != null)
            {
                GCPlayerStats stats = GCPlayerStats.get(playerBase);

                if (stats.spaceRaceInviteTeamID > 0)
                {
                    SpaceRaceManager.sendSpaceRaceData(playerBase, SpaceRaceManager.getSpaceRaceFromID(stats.spaceRaceInviteTeamID));
                    GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_OPEN_JOIN_RACE_GUI, new Object[] { stats.spaceRaceInviteTeamID }), playerBase);
                }
                else
                {
                    throw new Exception("You haven't been invited to a space race team!");
                }
            }
            else
            {
                throw new Exception("Could not find player with name: " + astring[0]);
            }
        }
        catch (final Exception var6)
        {
            throw new CommandException(var6.getMessage(), new Object[0]);
        }
    }
    else
    {
        throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.joinrace.noTeam", this.getCommandUsage(icommandsender)), new Object[0]);
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:39,代码来源:CommandJoinSpaceRace.java

示例4: renderDockingOverlay

import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; //导入方法依赖的package包/类
/**
 * Render the GUI when player is docking a vehicle
 */
public static void renderDockingOverlay()
{
    OverlayDockingRocket.screenTicks++;
    final ScaledResolution scaledresolution = ClientUtil.getScaledRes(OverlayDockingRocket.minecraft, OverlayDockingRocket.minecraft.displayWidth, OverlayDockingRocket.minecraft.displayHeight);
    final int width = scaledresolution.getScaledWidth();
    final int height = scaledresolution.getScaledHeight();
    OverlayDockingRocket.minecraft.entityRenderer.setupOverlayRendering();

    if (OverlayDockingRocket.minecraft.thePlayer.ridingEntity instanceof EntityAutoRocket)
    {
        EntityAutoRocket rocket = (EntityAutoRocket) OverlayDockingRocket.minecraft.thePlayer.ridingEntity;

        if (rocket.landing && rocket.targetVec != null)
        {
            double dX = Math.round((rocket.posX - rocket.targetVec.x) * 100.0D) / 100.0D;
            double dY = Math.round((rocket.posY - rocket.targetVec.y) * 100.0D) / 100.0D;
            double dZ = Math.round((rocket.posZ - rocket.targetVec.z) * 100.0D) / 100.0D;
            String dXStr = String.valueOf(dX);
            String dYStr = String.valueOf(dY);
            String dZStr = String.valueOf(dZ);

            String warning = GCCoreUtil.translateWithFormat("gui.dockingRocket.warning.name.0", GameSettings.getKeyDisplayString(KeyHandlerClient.spaceKey.getKeyCode()));
            String warning2 = GCCoreUtil.translateWithFormat("gui.dockingRocket.warning.name.1", GameSettings.getKeyDisplayString(KeyHandlerClient.leftShiftKey.getKeyCode()));

            double targetMotionY = Math.round(Math.max((rocket.posY - rocket.targetVec.y) / -100.0D, -0.9D) * 100.0D) / 100.0D;
            double currentMotionY = Math.round(rocket.motionY * 100.0D) / 100.0D;
            double dMY = Math.floor((targetMotionY - currentMotionY) * 300);
            int dMotionY = (int) Math.max(1, Math.min(255, dMY));
            int dMotionYN = (int) Math.max(1, Math.min(255, -dMY));
            String targetMotionYStr = GCCoreUtil.translate("gui.dockingRocket.targetVel.name") + ": " + String.valueOf(targetMotionY);
            String currentMotionYStr = GCCoreUtil.translate("gui.dockingRocket.currentVel.name") + ": " + String.valueOf(currentMotionY);

            int red = ColorUtil.to32BitColor(dMY > 0 ? 0 : dMotionYN, 255, 255, 255);
            int green = ColorUtil.to32BitColor(dMY < 0 ? 0 : dMotionY, 255, 255, 255);
            int grey = ColorUtil.to32BitColor(255, 220, 220, 220);

            if (dMY > 25)
            {
                OverlayDockingRocket.minecraft.fontRenderer.drawString(warning, width / 2 - OverlayDockingRocket.minecraft.fontRenderer.getStringWidth(warning) / 2, height / 3 - 50, green);
            }

            if (dMY < -25)
            {
                OverlayDockingRocket.minecraft.fontRenderer.drawString(warning2, width / 2 - OverlayDockingRocket.minecraft.fontRenderer.getStringWidth(warning2) / 2, height / 3 - 35, red);
            }

            OverlayDockingRocket.minecraft.fontRenderer.drawString(targetMotionYStr, width - OverlayDockingRocket.minecraft.fontRenderer.getStringWidth(targetMotionYStr) - 50, height / 3 + 50, grey);
            OverlayDockingRocket.minecraft.fontRenderer.drawString(currentMotionYStr, width - OverlayDockingRocket.minecraft.fontRenderer.getStringWidth(currentMotionYStr) - 50, height / 3 + 35, grey);

            OverlayDockingRocket.minecraft.fontRenderer.drawString(GCCoreUtil.translate("gui.dockingRocket.distanceFrom.name"), 50, height / 3 + 15, grey);
            OverlayDockingRocket.minecraft.fontRenderer.drawString("X: " + dXStr, 50, height / 3 + 35, Math.abs(dX) > 15 ? red : grey);
            OverlayDockingRocket.minecraft.fontRenderer.drawString("Y: " + dYStr, 50, height / 3 + 45, Math.abs(dY) > 50 || Math.abs(dY) < 1.9 ? grey : OverlayDockingRocket.screenTicks / 10 % 2 == 0 ? red : grey);
            OverlayDockingRocket.minecraft.fontRenderer.drawString("Z: " + dZStr, 50, height / 3 + 55, Math.abs(dZ) > 15 ? red : grey);
        }
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:60,代码来源:OverlayDockingRocket.java

示例5: processCommand

import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; //导入方法依赖的package包/类
@Override
public void processCommand(ICommandSender icommandsender, String[] astring)
{
    String var3 = null;
    EntityPlayerMP playerBase = null;

    if (astring.length > 0)
    {
        var3 = astring[0];

        try
        {
            playerBase = PlayerUtil.getPlayerBaseServerFromPlayerUsername(icommandsender.getCommandSenderName(), false);

            if (playerBase != null)
            {
                GCPlayerStats stats = GCPlayerStats.get(playerBase);

                if (stats.spaceStationDimensionData.isEmpty())
                {
                    throw new WrongUsageException(GCCoreUtil.translate("commands.ssinvite.notFound"), new Object[0]);
                }
                else
                {
                    for (Map.Entry<Integer, Integer> e : stats.spaceStationDimensionData.entrySet())
                    {
                        final SpaceStationWorldData data = SpaceStationWorldData.getStationData(playerBase.worldObj, e.getValue(), playerBase);

                        String str = null;
                        for (String name : data.getAllowedPlayers())
                        {
                            if (name.equalsIgnoreCase(var3))
                            {
                                str = name;
                                break;
                            }
                        }

                        if (str != null)
                        {
                            data.getAllowedPlayers().remove(str);
                            data.markDirty();
                        }
                        else
                        {
                            throw new CommandException(GCCoreUtil.translateWithFormat("commands.ssuninvite.noPlayer", "\"" + var3 + "\""), new Object[0]);
                        }
                    }
                }
            }
        }
        catch (final Exception var6)
        {
            throw new CommandException(var6.getMessage(), new Object[0]);
        }

    }
    else
    {
        throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.ssinvite.wrongUsage", this.getCommandUsage(icommandsender)), new Object[0]);
    }

    if (playerBase != null)
    {
        playerBase.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("gui.spacestation.removesuccess", var3)));
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:68,代码来源:CommandSpaceStationRemoveOwner.java

示例6: processCommand

import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; //导入方法依赖的package包/类
@Override
public void processCommand(ICommandSender icommandsender, String[] astring)
{
    String var3 = null;
    EntityPlayerMP playerBase = null;

    if (astring.length > 0)
    {
        var3 = astring[0];

        try
        {
            playerBase = PlayerUtil.getPlayerBaseServerFromPlayerUsername(icommandsender.getCommandSenderName(), true);

            if (playerBase != null)
            {
                GCPlayerStats stats = GCPlayerStats.get(playerBase);

                if (stats.spaceStationDimensionData.isEmpty())
                {
                    throw new WrongUsageException(GCCoreUtil.translate("commands.ssinvite.notFound"), new Object[0]);
                }
                else
                {
                    for (Map.Entry<Integer, Integer> ownedStations : stats.spaceStationDimensionData.entrySet())
                    {
                        final SpaceStationWorldData data = SpaceStationWorldData.getStationData(playerBase.worldObj, ownedStations.getValue(), playerBase);

                        if (var3.equalsIgnoreCase("+all"))
                        {
                        	data.setAllowedAll(true);
                            playerBase.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("gui.spacestation.allowAllTrue")));
                            return;
                        }
                        if (var3.equalsIgnoreCase("-all"))
                        {
                        	data.setAllowedAll(false);
                            playerBase.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("gui.spacestation.allowAllFalse", var3)));
                            return;
                        }
                        
                        if (!data.getAllowedPlayers().contains(var3))
                        {
                            data.getAllowedPlayers().add(var3);
                            data.markDirty();
                        }
                    }
                }

                final EntityPlayerMP playerToAdd = PlayerUtil.getPlayerBaseServerFromPlayerUsername(var3, true);

                if (playerToAdd != null)
                {
                    playerToAdd.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("gui.spacestation.added", playerBase.getGameProfile().getName())));
                }
            }
        }
        catch (final Exception var6)
        {
            throw new CommandException(var6.getMessage(), new Object[0]);
        }

    }
    else
    {
        throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.ssinvite.wrongUsage", this.getCommandUsage(icommandsender)), new Object[0]);
    }

    if (playerBase != null)
    {
        playerBase.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("gui.spacestation.addsuccess", var3)));
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:74,代码来源:CommandSpaceStationAddOwner.java

示例7: processCommand

import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; //导入方法依赖的package包/类
@Override
public void processCommand(ICommandSender icommandsender, String[] astring)
{
    EntityPlayerMP playerBase = PlayerUtil.getPlayerBaseServerFromPlayerUsername(icommandsender.getCommandSenderName(), true);
    if (playerBase == null)
    {
        return;
    }

    if (astring.length == 1)
    {
        String param = astring[0].toLowerCase();
        if (param.length() <= 2)
        {
            int paramvalue = 0;
            if ("gj".equals(param))
            {
                paramvalue = 1;
            }
            else if ("mj".equals(param) && EnergyConfigHandler.isBuildcraftLoaded())
            {
                paramvalue = 2;
            }
            else if ("eu".equals(param) && EnergyConfigHandler.isIndustrialCraft2Loaded())
            {
                paramvalue = 3;
            }
            else if ("j".equals(param) && EnergyConfigHandler.isMekanismLoaded())
            {
                paramvalue = 4;
            }
            else if ("rf".equals(param))
            {
                paramvalue = 5;
            }

            if (paramvalue > 0)
            {
                GalacticraftCore.packetPipeline.sendTo(new PacketSimple(EnumSimplePacket.C_UPDATE_ENERGYUNITS, new Object[] { paramvalue }), playerBase);
                return;
            }

        }

        throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.gcenergyunits.invalidUnits", this.getCommandUsage(icommandsender)), new Object[0]);
    }

    throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.gcenergyunits.noUnits", this.getCommandUsage(icommandsender)), new Object[0]);
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:50,代码来源:CommandGCEnergyUnits.java

示例8: processCommand

import micdoodle8.mods.galacticraft.core.util.GCCoreUtil; //导入方法依赖的package包/类
@Override
public void processCommand(ICommandSender icommandsender, String[] astring)
{
	if (astring.length > 2)
	{
        throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.dimensiontp.tooMany", this.getCommandUsage(icommandsender)), new Object[0]);
	}
	if (astring.length < 1)
	{
        throw new WrongUsageException(GCCoreUtil.translateWithFormat("commands.ssinvite.wrongUsage", this.getCommandUsage(icommandsender)), new Object[0]);
	}
	
	int type = 0;
	int newvalue = 0;
	if (astring[0].equalsIgnoreCase("show")) type = 1;
	else if (astring[0].equalsIgnoreCase("reset")) type = 2;
	else if (astring[0].length() > 3 && astring[0].substring(0,3).equalsIgnoreCase("set"))
	{
		String number = astring[0].substring(3);
        try
        {
            newvalue = Integer.parseInt(number);
    		if (newvalue > 0)
    			type = 3;
        }
        catch (NumberFormatException ex) { }
	}
	
	//Proceed if syntax of show|reset|set<number> was correct
	if (type > 0)
	{
		EntityPlayerMP playerBase = null;
        try
        {
            if (astring.length == 2)
                playerBase = PlayerUtil.getPlayerBaseServerFromPlayerUsername(astring[1], true);
            else
                playerBase = PlayerUtil.getPlayerBaseServerFromPlayerUsername(icommandsender.getCommandSenderName(), true);

            if (playerBase != null)
            {
                GCPlayerStats stats = GCPlayerStats.get(playerBase);
                switch (type)
                {
                case 1: 
                	icommandsender.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + stats.astroMinerCount)));
                	break;
                case 2:
                	stats.astroMinerCount = 0;
                	icommandsender.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + 0)));
                	break;
                case 3:
                	stats.astroMinerCount = newvalue;
                	icommandsender.addChatMessage(new ChatComponentText(GCCoreUtil.translateWithFormat("command.gcastrominer.count", playerBase.getGameProfile().getName(), "" + newvalue)));
                	break;
                }
            }
            else
            {
                throw new Exception("Could not find player with name: " + astring[1]);
            }
        }
        catch (final Exception e)
        {
            throw new CommandException(e.getMessage(), new Object[0]);
        }
        return;
    }
}
 
开发者ID:4Space,项目名称:4Space-5,代码行数:70,代码来源:CommandGCAstroMiner.java


注:本文中的micdoodle8.mods.galacticraft.core.util.GCCoreUtil.translateWithFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。