• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java SPacketTitle类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中net.minecraft.network.play.server.SPacketTitle的典型用法代码示例。如果您正苦于以下问题:Java SPacketTitle类的具体用法?Java SPacketTitle怎么用?Java SPacketTitle使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SPacketTitle类属于net.minecraft.network.play.server包,在下文中一共展示了SPacketTitle类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: handleTitle

import net.minecraft.network.play.server.SPacketTitle; //导入依赖的package包/类
@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());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:26,代码来源:NetHandlerPlayClient.java


示例2: fireTestStarted

import net.minecraft.network.play.server.SPacketTitle; //导入依赖的package包/类
@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);
  }
}
 
开发者ID:wizards-of-lua,项目名称:wizards-of-lua,代码行数:17,代码来源:TestResults.java


示例3: onItemUseFinish

import net.minecraft.network.play.server.SPacketTitle; //导入依赖的package包/类
@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;
}
 
开发者ID:Szewek,项目名称:Minecraft-Flux,代码行数:19,代码来源:ItemUpChip.java


示例4: handleTitle

import net.minecraft.network.play.server.SPacketTitle; //导入依赖的package包/类
@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());
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:32,代码来源:NetHandlerPlayClient.java


示例5: create

import net.minecraft.network.play.server.SPacketTitle; //导入依赖的package包/类
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);
		}
	}
}
 
开发者ID:TheXFactor117,项目名称:Levels,代码行数:35,代码来源:WeaponHelper.java


示例6: execute

import net.minecraft.network.play.server.SPacketTitle; //导入依赖的package包/类
/**
 * 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]);
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:81,代码来源:CommandTitle.java


示例7: getTabCompletionOptions

import net.minecraft.network.play.server.SPacketTitle; //导入依赖的package包/类
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());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:5,代码来源:CommandTitle.java


示例8: handleTitle

import net.minecraft.network.play.server.SPacketTitle; //导入依赖的package包/类
void handleTitle(SPacketTitle packetIn); 
开发者ID:sudofox,项目名称:Backmemed,代码行数:2,代码来源:INetHandlerPlayClient.java



注:本文中的net.minecraft.network.play.server.SPacketTitle类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java WebResponseExceptionTranslator类代码示例发布时间:2022-05-22
下一篇:
Java SpellingParams类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap