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


Java IThreadListener.addScheduledTask方法代码示例

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


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

示例1: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PacketClassGui message, final MessageContext ctx) 
{			
	IThreadListener mainThread = Minecraft.getMinecraft();
	mainThread.addScheduledTask(new Runnable()
	{
		@Override
		public void run() 
		{
			EntityPlayer player = Minecraft.getMinecraft().player;
			PlayerInformation playerInfo = (PlayerInformation) player.getCapability(CapabilityPlayerInformation.PLAYER_INFORMATION, null);
			
			if (playerInfo != null && playerInfo.getPlayerClass() == 0)
			{
				player.openGui(LootSlashConquer.instance, GuiHandler.CLASS_SELECTION, player.getEntityWorld(), player.getPosition().getX(), player.getPosition().getY(), player.getPosition().getZ());
			}
		}
	});
	
	return null;
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:22,代码来源:PacketClassGui.java

示例2: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PacketUpdateChunkLevel message, final MessageContext ctx) 
{			
	IThreadListener mainThread = Minecraft.getMinecraft();
	mainThread.addScheduledTask(new Runnable()
	{
		@Override
		public void run() 
		{
			World world = Minecraft.getMinecraft().world;
			ChunkPos chunkPos = new ChunkPos(message.chunkX, message.chunkZ);
			
			IChunkLevelHolder chunkLevelHolder = CapabilityChunkLevel.getChunkLevelHolder(world);
			
			if (chunkLevelHolder.getChunkLevel(chunkPos) != null) return;
			
			IChunkLevel chunkLevel = new ChunkLevel(world, chunkPos, message.level);
			chunkLevelHolder.setChunkLevel(chunkPos, chunkLevel);
		}
	});
	
	return null;
}
 
开发者ID:TheXFactor117,项目名称:Loot-Slash-Conquer,代码行数:24,代码来源:PacketUpdateChunkLevel.java

示例3: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final ConfigSyncMessage message, MessageContext ctx)
{
	IThreadListener threadListener = this.getThreadListener(ctx);
	threadListener.addScheduledTask(new Runnable()
	{

		@Override
		public void run()
		{
			ModConfiguration.enableInventoryGui = message.enableInventoryGui;
			ModConfiguration.enableDeathDrops = message.enableDeathDrops;
			ModConfiguration.requireEmptyHand = message.requireEmptyHand;
		}
	});

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

示例4: channelRead0

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
protected void channelRead0(ChannelHandlerContext ctx, final OpenGui msg) throws Exception
{
    IThreadListener thread = FMLCommonHandler.instance().getWorldThread(ctx.channel().attr(NetworkRegistry.NET_HANDLER).get());
    if (thread.isCallingFromMinecraftThread())
    {
        process(msg);
    }
    else
    {
        thread.addScheduledTask(new Runnable()
        {
            public void run()
            {
                OpenGuiHandler.this.process(msg);
            }
        });
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:OpenGuiHandler.java

示例5: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PacketMaxMana message, MessageContext ctx) 
{			
	IThreadListener mainThread = Minecraft.getMinecraft();
	mainThread.addScheduledTask(new Runnable()
	{
		@Override
		public void run() 
		{	
			EntityPlayer entity = Minecraft.getMinecraft().player;
			
			if (entity instanceof EntityPlayer)
			{
				final IMaxMana mana = CapabilityMaxMana.getMaxMana(entity);
				mana.setMaxMana(message.mana);
			}
		}
	});
	
	return null;
}
 
开发者ID:TheXFactor117,项目名称:Lost-Eclipse-Outdated,代码行数:22,代码来源:PacketMaxMana.java

示例6: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PacketMana message, MessageContext ctx) 
{			
	IThreadListener mainThread = Minecraft.getMinecraft();
	mainThread.addScheduledTask(new Runnable()
	{
		@Override
		public void run() 
		{	
			EntityPlayer entity = Minecraft.getMinecraft().player;
			
			if (entity instanceof EntityPlayer)
			{
				final IMana mana = CapabilityMana.getMana(entity);
				LostEclipse.LOGGER.info("Sending mana over to client: " + message.mana);
				mana.setMana(message.mana);
			}
		}
	});
	
	return null;
}
 
开发者ID:TheXFactor117,项目名称:Lost-Eclipse-Outdated,代码行数:23,代码来源:PacketMana.java

示例7: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageLegalMovesResponse message, MessageContext ctx) {

  if (message.legalPositions == null || message.controlBlockPos == null) {
    return null;
  }

  IThreadListener mainThread = Minecraft.getMinecraft();

  mainThread.addScheduledTask(new Runnable() {
    @Override
    public void run() {
      CheckerBoardOverlay.INSTANCE.setValidMoves(message.legalPositions);
    }
  });

  return null;
}
 
开发者ID:ToroCraft,项目名称:ToroChess,代码行数:19,代码来源:MessageLegalMovesResponse.java

示例8: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final MessageUpdateControlBlock message, MessageContext ctx) {

  if (message.controlBlockPos == null) {
    return null;
  }

  final IThreadListener mainThread = Minecraft.getMinecraft();
  final EntityPlayerSP player = Minecraft.getMinecraft().player;

  mainThread.addScheduledTask(new Runnable() {
    @Override
    public void run() {
      TileEntityChessControl control = ItemChessControlWand.getChessControlAt(player.world, message.controlBlockPos);
      if (control == null) {
        System.out.println("control block not found");
        return;
      }
      control.readFromNBT(message.data);
    }
  });

  return null;
}
 
开发者ID:ToroCraft,项目名称:ToroChess,代码行数:25,代码来源:MessageUpdateControlBlock.java

示例9: reloadResources

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
public static void reloadResources(@Nonnull final Side side) {
	// Reload can be called on either side so make sure we queue
	// up a scheduled task appropriately.
	if (managers.hasValue(side)) {
		final IThreadListener tl = side == Side.SERVER ? FMLCommonHandler.instance().getMinecraftServerInstance()
				: Minecraft.getMinecraft();
		if (tl == null)
			managers.clear(side);
		else
			tl.addScheduledTask(new Runnable() {
				public void run() {
					managers.get().reload();
				}
			});
	}
}
 
开发者ID:OreCruncher,项目名称:DynamicSurroundings,代码行数:17,代码来源:RegistryManager.java

示例10: processMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
/** IMPORTANT: Call this from the onMessage method in the subclass. */
public IMessage processMessage(ObservationRequestMessage message, MessageContext ctx)
{
    IThreadListener mainThread = (WorldServer) ctx.getServerHandler().playerEntity.world;
    final EntityPlayerMP player = ctx.getServerHandler().playerEntity;
    final ObservationRequestMessage mess = message;
    mainThread.addScheduledTask(new Runnable()
    {
        @Override
        public void run()
        {
            JsonObject json = new JsonObject();
            buildJson(json, player, mess);
            // Send this message back again now we've filled in the json stats.
            Map<String, String> returnData = new HashMap<String, String>();
            returnData.put("json", json.toString());
            mess.addReturnData(returnData);
            MalmoMod.network.sendTo(new MalmoMod.MalmoMessage(MalmoMessageType.SERVER_OBSERVATIONSREADY, mess.id, returnData), player);
        }
    });
    return null; // no response in this case
}
 
开发者ID:Microsoft,项目名称:malmo,代码行数:23,代码来源:ObservationFromServer.java

示例11: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final RecipeNavigationMessage message, MessageContext ctx)
{
	final EntityPlayerMP player = ctx.getServerHandler().player;

	IThreadListener threadListener = (WorldServer)player.world;
	threadListener.addScheduledTask(new Runnable()
	{
		@Override
		public void run()
		{
			Container container = player.openContainer;
			if (container instanceof ContainerUncraftingTable)
			{
				ContainerUncraftingTable uncraftingContainer = (ContainerUncraftingTable)container;
				uncraftingContainer.uncraftingResult.selectedCraftingGrid = message.recipeIndex;
				uncraftingContainer.switchRecipe();
			}
		}
	});

	return null;
}
 
开发者ID:crazysnailboy,项目名称:UncraftingTable,代码行数:24,代码来源:RecipeNavigationMessage.java

示例12: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final StructureTagMessage message, final MessageContext ctx) 
{
	// Or Minecraft.getMinecraft() on the client.
	IThreadListener mainThread = (WorldServer) ctx.getServerHandler().player.world; 

	mainThread.addScheduledTask(new Runnable()
	{
		@Override
		public void run() 
		{
			// This is server side. Build the structure.
			EnumStructureConfiguration structureConfig = message.getStructureConfig();
			
			StructureConfiguration configuration = structureConfig.structureConfig.ReadFromNBTTagCompound(message.getMessageTag());
			configuration.BuildStructure(ctx.getServerHandler().player, ctx.getServerHandler().player.world);
		}
	});

	// no response in this case
	return null;
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:23,代码来源:StructureHandler.java

示例13: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final PlayerEntityTagMessage message, final MessageContext ctx) 
{
	// Or Minecraft.getMinecraft() on the client.
	IThreadListener mainThread = Minecraft.getMinecraft();

	mainThread.addScheduledTask(new Runnable()
	{
		@Override
		public void run() 
		{
			// This is client side.
			NBTTagCompound newPlayerTag = Minecraft.getMinecraft().player.getEntityData();
			newPlayerTag.setTag(EntityPlayerConfiguration.PLAYER_ENTITY_TAG, message.getMessageTag());
			ClientEventHandler.playerConfig.loadFromNBTTagCompound(message.getMessageTag());
		}
	});

	// no response in this case
	return null;
}
 
开发者ID:Brian-Wuest,项目名称:MC-Prefab,代码行数:22,代码来源:PlayerEntityHandler.java

示例14: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final EntityTileEntityUpdateMessage message, final MessageContext ctx)
{
	IThreadListener mainThread = MoarCarts.proxy.getIThreadListener(ctx);
	mainThread.addScheduledTask(new Runnable() {
		@Override
		public void run() {
			EntityMinecartTEBase minecartTEBase = message.getEntityMinecartTEBaseFromMessage(ctx);

			if(minecartTEBase != null)
			{
				minecartTEBase.getTileEntity().readFromNBT(message.nbtTagCompound);
			}
		}
	});
	return null;
}
 
开发者ID:BrassGoggledCoders,项目名称:MoarCarts,代码行数:18,代码来源:EntityTileEntityUpdateMessage.java

示例15: onMessage

import net.minecraft.util.IThreadListener; //导入方法依赖的package包/类
@Override
public IMessage onMessage(final CAnvilStrikePacket message, MessageContext ctx) {
	IThreadListener mainThread = net.minecraft.client.Minecraft.getMinecraft(); //(WorldServer) ctx.getServerHandler().playerentityIn.world; // or Minecraft.getMinecraft() on the client
	mainThread.addScheduledTask(new Runnable() 
	{
		@Override
		public void run() 
		{
			TileEntity te = net.minecraft.client.Minecraft.getMinecraft().world.getTileEntity(message.pos);
			if(te != null)
			{
				TileAnvil anvil = (TileAnvil)te;
				anvil.setStrikePoint(message.strikeIndex, message.strikePoint);
			}
		}
	});
	return null; // no response in this case
}
 
开发者ID:Deadrik,项目名称:TFC2,代码行数:19,代码来源:CAnvilStrikePacket.java


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