當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。