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


Java Minecraft.addScheduledTask方法代码示例

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


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

示例1: execute

import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public void execute(String[] args) throws CmdError
{
	if(args.length != 1)
		syntaxError();
	
	Minecraft mc = Minecraft.getMinecraft();
	
	mc.addScheduledTask(() -> {
		
		mc.displayGuiScreen(new GuiConnecting(new GuiWurstMainMenu(), mc,
			new ServerData("", args[0], false)));
		
		System.out.println(
			"Joined " + args[0] + " as " + mc.session.getUsername());
	});
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:18,代码来源:JoinCmd.java

示例2: onMessage

import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
@SideOnly(Side.CLIENT)
public IMessage onMessage(MessageReceiveConfiguration message, MessageContext ctx) {
    FirstAid.activeHealingConfig = message.healingCfg;
    FirstAid.activeDamageConfig = message.damageCfg;
    FirstAid.scaleMaxHealth = message.scaleMaxHealth;
    AbstractPlayerDamageModel damageModel = PlayerDamageModel.create();
    damageModel.deserializeNBT(message.playerDamageModel);
    Minecraft mc = Minecraft.getMinecraft();

    FirstAid.playerMaxHealth = FirstAid.activeDamageConfig.maxHealthHead + FirstAid.activeDamageConfig.maxHealthLeftArm
            + FirstAid.activeDamageConfig.maxHealthLeftLeg + FirstAid.activeDamageConfig.maxHealthLeftFoot
            + FirstAid.activeDamageConfig.maxHealthBody + FirstAid.activeDamageConfig.maxHealthRightArm
            + FirstAid.activeDamageConfig.maxHealthRightLeg + FirstAid.activeDamageConfig.maxHealthRightFoot;

    FirstAid.logger.info("Received configuration");
    mc.addScheduledTask(() -> {
        PlayerDataManager.capList.put(mc.player, damageModel);
        if (damageModel.hasTutorial)
            PlayerDataManager.tutorialDone.add(mc.player.getName());
        else
            mc.player.sendMessage(new TextComponentString("[First Aid] " + I18n.format("firstaid.tutorial.hint", ClientProxy.showWounds.getDisplayName())));
    });
    return null;
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:26,代码来源:MessageReceiveConfiguration.java

示例3: onMessage

import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final JumpkinRotationMessage message, MessageContext ctx)
{
	Minecraft minecraft = Minecraft.getMinecraft();
	final WorldClient world = minecraft.world;

	minecraft.addScheduledTask(new Runnable()
	{
		@Override
		public void run()
		{
			EntityJumpkin entity = (EntityJumpkin)world.getEntityByID(message.entityId);
			entity.rotationYaw = message.rotationYaw;
			entity.rotationPitch = message.rotationPitch;
		}
	});
	return null;
}
 
开发者ID:crazysnailboy,项目名称:Halloween,代码行数:19,代码来源:JumpkinRotationMessage.java

示例4: onMessage

import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageClientPlanetChange message, final MessageContext ctx)
{
    if(ctx.side != Side.CLIENT)
    {
        System.err.println("MessageClientPlanetChange received on wrong side:" + ctx.side);
        return null;
    }

    Minecraft minecraft = Minecraft.getMinecraft();
    final WorldClient worldClient = minecraft.world;
    minecraft.addScheduledTask(() -> processMessage(message, ctx, worldClient));
    return null;
}
 
开发者ID:Lumaceon,项目名称:CraftingParadiseMod,代码行数:15,代码来源:HandlerClientPlanetChange.java

示例5: onMessage

import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageBiomeChange message, final MessageContext ctx)
{
    if(ctx.side != Side.CLIENT)
    {
        System.err.println("MessageBiomeChange received on wrong side:" + ctx.side);
        return null;
    }

    Minecraft minecraft = Minecraft.getMinecraft();
    final WorldClient worldClient = minecraft.world;
    minecraft.addScheduledTask(() -> processMessage(message, ctx, worldClient));
    return null;
}
 
开发者ID:Lumaceon,项目名称:CraftingParadiseMod,代码行数:15,代码来源:HandlerBiomeChange.java

示例6: onMessage

import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final VillagerCareerMessage message, MessageContext ctx)
{
	Minecraft minecraft = Minecraft.getMinecraft();
	final WorldClient world = minecraft.world;

	minecraft.addScheduledTask(new Runnable()
	{

		@Override
		public void run()
		{
			// get the entity referenced by the specified id
			Entity entity = world.getEntityByID(message.entityId);

			// ensure that the entity is a villager
			if (entity instanceof EntityVillager)
			{
				// cast the entity to type EntityVillager
				EntityVillager villager = (EntityVillager)entity;

				// read the villager's nbt data into a tag compound
				NBTTagCompound compound = new NBTTagCompound();
				villager.writeEntityToNBT(compound);
				// set the career property of the tag compound and write it back to the villager
				compound.setInteger("Career", message.careerId);
				villager.readEntityFromNBT(compound);

				// if there's currently an instance of the villager inventory screen open
				GuiScreen currentScreen = Minecraft.getMinecraft().currentScreen;
				if (currentScreen != null && currentScreen instanceof GuiVillagerInventory)
				{
					// update the nbt data for the villager attached to the screen from the tag compound
					((GuiVillagerInventory)currentScreen).readVillagerFromNBT(compound);
				}
			}
		}
	});

	return null;
}
 
开发者ID:crazysnailboy,项目名称:VillagerInventory,代码行数:42,代码来源:VillagerCareerMessage.java

示例7: channelRead0

import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, SPacketJoinGame msg) throws Exception {

       if (ctx.channel().isOpen())
       {
           try
           {

   	    	try {

   	    		NetHandlerPlayClient handler = (NetHandlerPlayClient) m_manager.getNetHandler();

   	    		Minecraft scheduler = InjectionHandler.readFieldOfType(handler, Minecraft.class);

                if (!scheduler.isCallingFromMinecraftThread())
                {
                    scheduler.addScheduledTask(new Runnable()
                    {
                        public void run()
                        {
                            invoke(msg);
                        }
                    });
                    throw ThreadQuickExitException.INSTANCE;
                } else {
                	invoke(msg);
                }

   	    	} catch (Exception e) {

   	    		if (e instanceof ThreadQuickExitException) throw e;

   	    		Util.logger.logException("Unable to get scheduler!", e);

   	    		// we died - let vanilla take over!
   	    		ctx.fireChannelRead(msg);
   	    		return;
   	    	}



           }
           catch (ThreadQuickExitException var4)
           {
               ;
           }
       }

}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:50,代码来源:JoinGameInterceptor.java

示例8: channelRead0

import net.minecraft.client.Minecraft; //导入方法依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, SPacketRespawn msg) throws Exception {
       if (ctx.channel().isOpen())
       {
           try
           {

           	try {

    	    	NetHandlerPlayClient handler = (NetHandlerPlayClient) m_manager.getNetHandler();

   	    		Minecraft scheduler = InjectionHandler.readFieldOfType(handler, Minecraft.class);

                if (!scheduler.isCallingFromMinecraftThread())
                {
                    scheduler.addScheduledTask(new Runnable()
                    {
                        @Override
						public void run()
                        {
                            invoke(msg);
                        }
                    });
                    throw ThreadQuickExitException.INSTANCE;
                } else {
                	invoke(msg);
                }

   	    	} catch (Exception e) {

   	    		if (e instanceof ThreadQuickExitException) throw e;

   	    		Util.logger.logException("Unable to get scheduler!", e);

   	    		// we died - let vanilla take over!
   	    		ctx.fireChannelRead(msg);
   	    		return;
   	    	}

           }
           catch (ThreadQuickExitException var4)
           {
               ;
           }
       }
}
 
开发者ID:orbwoi,项目名称:UniversalRemote,代码行数:47,代码来源:RespawnInterceptor.java


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