Java 类net.minecraft.network.play.server.SPacketTitle 实例源码

项目:CustomWorldGen    文件:NetHandlerPlayClient.java   
@SuppressWarnings("incomplete-switch")
public void handleTitle(SPacketTitle packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    SPacketTitle.Type spackettitle$type = packetIn.getType();
    String s = null;
    String s1 = null;
    String s2 = packetIn.getMessage() != null ? packetIn.getMessage().getFormattedText() : "";

    switch (spackettitle$type)
    {
        case TITLE:
            s = s2;
            break;
        case SUBTITLE:
            s1 = s2;
            break;
        case RESET:
            this.gameController.ingameGUI.displayTitle("", "", -1, -1, -1);
            this.gameController.ingameGUI.setDefaultTitlesTimes();
            return;
    }

    this.gameController.ingameGUI.displayTitle(s, s1, packetIn.getFadeInTime(), packetIn.getDisplayTime(), packetIn.getFadeOutTime());
}
项目:wizards-of-lua    文件:TestResults.java   
@Override
public void fireTestStarted(Description description) throws StoppedByUserException {
  super.fireTestStarted(description);
  String message = "Running " + description.getDisplayName();
  logger.info(message);

  try {
    EntityPlayerMP player = server.getPlayerList().getPlayerByUsername(playerName);
    ITextComponent itextcomponent = new TextComponentString(message);
    SPacketTitle packet = new SPacketTitle(SPacketTitle.Type.ACTIONBAR,
        TextComponentUtils.processComponent(player, itextcomponent, player));
    player.connection.sendPacket(packet);
  } catch (CommandException e) {
    throw new RuntimeException(e);
  }
}
项目:Minecraft-Flux    文件:ItemUpChip.java   
@Override
public ItemStack onItemUseFinish(ItemStack is, World w, EntityLivingBase elb) {
    if (!w.isRemote && elb instanceof EntityPlayerMP) {
        final EntityPlayerMP mp = (EntityPlayerMP) elb;
        PlayerEnergy pe = mp.getCapability(PlayerEnergy.SELF_CAP, null);
        if (pe == null)
            return is;
        byte lvl = pe.updateLevel();
        if (lvl == -1)
            return is;
        is.grow(-1);
        mp.connection.sendPacket(new SPacketTitle(SPacketTitle.Type.TITLE, textInstalled, 50, 500, 50));
        mp.connection.sendPacket(new SPacketTitle(SPacketTitle.Type.SUBTITLE, lvl == 30 ? textLvlMax : new TextComponentTranslation(PF + "lvlup", lvl)));
        StatBase stat = StatList.getObjectUseStats(this);
        if (stat != null) mp.addStat(stat);
    }
    return is;
}
项目:ExpandedRailsMod    文件:NetHandlerPlayClient.java   
@SuppressWarnings("incomplete-switch")
public void handleTitle(SPacketTitle packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    SPacketTitle.Type spackettitle$type = packetIn.getType();
    String s = null;
    String s1 = null;
    String s2 = packetIn.getMessage() != null ? packetIn.getMessage().getFormattedText() : "";

    switch (spackettitle$type)
    {
        case TITLE:
            s = s2;
            break;
        case SUBTITLE:
            s1 = s2;
            break;
        case RESET:
            this.gameController.ingameGUI.displayTitle("", "", -1, -1, -1);
            this.gameController.ingameGUI.setDefaultTitlesTimes();
            return;
    }

    this.gameController.ingameGUI.displayTitle(s, s1, packetIn.getFadeInTime(), packetIn.getDisplayTime(), packetIn.getFadeOutTime());
}
项目:Zombe-Modpack    文件:NetHandlerPlayClient.java   
@SuppressWarnings("incomplete-switch")
public void handleTitle(SPacketTitle packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    SPacketTitle.Type spackettitle$type = packetIn.getType();
    String s = null;
    String s1 = null;
    String s2 = packetIn.getMessage() != null ? packetIn.getMessage().getFormattedText() : "";

    switch (spackettitle$type)
    {
        case TITLE:
            s = s2;
            break;

        case SUBTITLE:
            s1 = s2;
            break;

        case ACTIONBAR:
            this.gameController.ingameGUI.setRecordPlaying(s2, false);
            return;

        case RESET:
            this.gameController.ingameGUI.displayTitle("", "", -1, -1, -1);
            this.gameController.ingameGUI.setDefaultTitlesTimes();
            return;
    }

    this.gameController.ingameGUI.displayTitle(s, s1, packetIn.getFadeInTime(), packetIn.getDisplayTime(), packetIn.getFadeOutTime());
}
项目:Backmemed    文件:NetHandlerPlayClient.java   
@SuppressWarnings("incomplete-switch")
public void handleTitle(SPacketTitle packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);
    SPacketTitle.Type spackettitle$type = packetIn.getType();
    String s = null;
    String s1 = null;
    String s2 = packetIn.getMessage() != null ? packetIn.getMessage().getFormattedText() : "";

    switch (spackettitle$type)
    {
        case TITLE:
            s = s2;
            break;

        case SUBTITLE:
            s1 = s2;
            break;

        case ACTIONBAR:
            this.gameController.ingameGUI.setRecordPlaying(s2, false);
            return;

        case RESET:
            this.gameController.ingameGUI.displayTitle("", "", -1, -1, -1);
            this.gameController.ingameGUI.setDefaultTitlesTimes();
            return;
    }

    this.gameController.ingameGUI.displayTitle(s, s1, packetIn.getFadeInTime(), packetIn.getDisplayTime(), packetIn.getFadeOutTime());
}
项目:Levels    文件:WeaponHelper.java   
public static void create(ItemStack stack, EntityPlayer player)
{
    NBTTagCompound nbt = NBTHelper.loadStackNBT(stack);

    if (nbt != null)
    {
        Rarity rarity = Rarity.getRarity(nbt);
        Random rand = player.getEntityWorld().rand;

        if (rarity == Rarity.DEFAULT)
        {               
            Rarity.setRarity(nbt, Rarity.getRandomRarity(nbt, rand)); // sets random rarity

            if (Rarity.getRarity(nbt) == Rarity.MYTHIC)
            {
                SPacketTitle packet = new SPacketTitle(SPacketTitle.Type.TITLE, new TextComponentString(TextFormatting.GOLD + "MYTHIC"), -1, 20, -1);
                EntityPlayerMP playermp = (EntityPlayerMP) player;
                playermp.connection.sendPacket(packet);
                Levels.network.sendTo(new PacketMythicSound(), (EntityPlayerMP) player);
            }

            if (Config.unlimitedDurability)
            {
                nbt.setInteger("Unbreakable", 1); // adds Unbreakable tag to item
            }

            Experience.setLevel(nbt, 1);
            nbt.setDouble("Multiplier", getWeightedMultiplier(Rarity.getRarity(nbt))); // adds a randomized multiplier to the item, weighted by rarity
            nbt.setInteger("HideFlags", 6); // hides Attribute Modifier and Unbreakable tags
            setAttributeModifiers(nbt, stack); // sets up Attribute Modifiers
            NBTHelper.saveStackNBT(stack, nbt);
        }
    }
}
项目:Backmemed    文件:CommandTitle.java   
/**
 * Callback for when the command is executed
 */
public void execute(MinecraftServer server, ICommandSender sender, String[] args) throws CommandException
{
    if (args.length < 2)
    {
        throw new WrongUsageException("commands.title.usage", new Object[0]);
    }
    else
    {
        if (args.length < 3)
        {
            if ("title".equals(args[1]) || "subtitle".equals(args[1]) || "actionbar".equals(args[1]))
            {
                throw new WrongUsageException("commands.title.usage.title", new Object[0]);
            }

            if ("times".equals(args[1]))
            {
                throw new WrongUsageException("commands.title.usage.times", new Object[0]);
            }
        }

        EntityPlayerMP entityplayermp = getPlayer(server, sender, args[0]);
        SPacketTitle.Type spackettitle$type = SPacketTitle.Type.byName(args[1]);

        if (spackettitle$type != SPacketTitle.Type.CLEAR && spackettitle$type != SPacketTitle.Type.RESET)
        {
            if (spackettitle$type == SPacketTitle.Type.TIMES)
            {
                if (args.length != 5)
                {
                    throw new WrongUsageException("commands.title.usage", new Object[0]);
                }
                else
                {
                    int i = parseInt(args[2]);
                    int j = parseInt(args[3]);
                    int k = parseInt(args[4]);
                    SPacketTitle spackettitle2 = new SPacketTitle(i, j, k);
                    entityplayermp.connection.sendPacket(spackettitle2);
                    notifyCommandListener(sender, this, "commands.title.success", new Object[0]);
                }
            }
            else if (args.length < 3)
            {
                throw new WrongUsageException("commands.title.usage", new Object[0]);
            }
            else
            {
                String s = buildString(args, 2);
                ITextComponent itextcomponent;

                try
                {
                    itextcomponent = ITextComponent.Serializer.jsonToComponent(s);
                }
                catch (JsonParseException jsonparseexception)
                {
                    throw toSyntaxException(jsonparseexception);
                }

                SPacketTitle spackettitle1 = new SPacketTitle(spackettitle$type, TextComponentUtils.processComponent(sender, itextcomponent, entityplayermp));
                entityplayermp.connection.sendPacket(spackettitle1);
                notifyCommandListener(sender, this, "commands.title.success", new Object[0]);
            }
        }
        else if (args.length != 2)
        {
            throw new WrongUsageException("commands.title.usage", new Object[0]);
        }
        else
        {
            SPacketTitle spackettitle = new SPacketTitle(spackettitle$type, (ITextComponent)null);
            entityplayermp.connection.sendPacket(spackettitle);
            notifyCommandListener(sender, this, "commands.title.success", new Object[0]);
        }
    }
}
项目:Backmemed    文件:CommandTitle.java   
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    return args.length == 1 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, SPacketTitle.Type.getNames()) : Collections.<String>emptyList());
}
项目:CustomWorldGen    文件:CommandTitle.java   
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    return args.length == 1 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, SPacketTitle.Type.getNames()) : Collections.<String>emptyList());
}
项目:ExpandedRailsMod    文件:CommandTitle.java   
public List<String> getTabCompletionOptions(MinecraftServer server, ICommandSender sender, String[] args, @Nullable BlockPos pos)
{
    return args.length == 1 ? getListOfStringsMatchingLastWord(args, server.getAllUsernames()) : (args.length == 2 ? getListOfStringsMatchingLastWord(args, SPacketTitle.Type.getNames()) : Collections.<String>emptyList());
}
项目:Backmemed    文件:INetHandlerPlayClient.java   
void handleTitle(SPacketTitle packetIn);
项目:CustomWorldGen    文件:INetHandlerPlayClient.java   
void handleTitle(SPacketTitle packetIn);