當前位置: 首頁>>代碼示例>>Java>>正文


Java IThreadListener.isCallingFromMinecraftThread方法代碼示例

本文整理匯總了Java中net.minecraft.util.IThreadListener.isCallingFromMinecraftThread方法的典型用法代碼示例。如果您正苦於以下問題:Java IThreadListener.isCallingFromMinecraftThread方法的具體用法?Java IThreadListener.isCallingFromMinecraftThread怎麽用?Java IThreadListener.isCallingFromMinecraftThread使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在net.minecraft.util.IThreadListener的用法示例。


在下文中一共展示了IThreadListener.isCallingFromMinecraftThread方法的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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

示例2: channelRead0

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
@Override
protected void channelRead0(ChannelHandlerContext ctx, final EntityMessage 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()
            {
                EntitySpawnHandler.this.process(msg);
            }
        });
    }
}
 
開發者ID:F1r3w477,項目名稱:CustomWorldGen,代碼行數:20,代碼來源:EntitySpawnHandler.java

示例3: onMessage

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
@Override
@Nullable
public IMessage onMessage(final T message, final MessageContext context) {
  final IThreadListener thread = FMLCommonHandler.instance().getWorldThread(context.netHandler);
  if (thread.isCallingFromMinecraftThread()) {
    onMessageSynchronized(message, context);
  } else {
    thread.addScheduledTask(() -> onMessageSynchronized(message, context));
  }
  return null;
}
 
開發者ID:ToroCraft,項目名稱:Minecoprocessors,代碼行數:12,代碼來源:AbstractMessageHandler.java

示例4: checkThreadAndEnqueue

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
public static <T extends INetHandler> void checkThreadAndEnqueue(final Packet<T> p_180031_0_, final T p_180031_1_, IThreadListener p_180031_2_) throws ThreadQuickExitException
{
    if (!p_180031_2_.isCallingFromMinecraftThread())
    {
        p_180031_2_.addScheduledTask(new Runnable()
        {
            public void run()
            {
                p_180031_0_.processPacket(p_180031_1_);
            }
        });
        throw ThreadQuickExitException.field_179886_a;
    }
}
 
開發者ID:Notoh,項目名稱:DecompiledMinecraft,代碼行數:15,代碼來源:PacketThreadUtil.java

示例5: HandleDataMismatch

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
private void HandleDataMismatch(OpenGuiWrapper msg, RemoteGuiPlayerData data, EntityPlayerMP player, ChannelHandlerContext ctx)
 {
// sometimes multiblocks trigger UI from another position!
// time to re-issue with the correct information

// however we could be on the networking thread!

 	IThreadListener scheduler = FMLCommonHandler.instance().getWorldThread(ctx.channel().attr(NetworkRegistry.NET_HANDLER).get());

     if (!scheduler.isCallingFromMinecraftThread())
     {
     	Util.logger.warn("HandleDataMismatch scheduling PrepareReissueRequest!");
         scheduler.addScheduledTask(new Runnable()
         {
             @Override
	public void run()
             {
             	PrepareReissueRequest(msg, data, player);
             }
         });

     } else {

     	PrepareReissueRequest(msg, data, player);

     }
 }
 
開發者ID:orbwoi,項目名稱:UniversalRemote,代碼行數:28,代碼來源:OpenGuiFilterServer.java

示例6: checkThreadAndEnqueue

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
public static <T extends IMessage> boolean checkThreadAndEnqueue(final T message, final IMessageHandler<T, IMessage> handler, final MessageContext ctx, IThreadListener listener)
{
    if (!listener.isCallingFromMinecraftThread())
    {
        listener.addScheduledTask(() -> handler.onMessage(message, ctx));
        return true;
    }

    return false;
}
 
開發者ID:cubex2,項目名稱:customstuff4,代碼行數:11,代碼來源:NetworkHelper.java

示例7: checkThreadAndEnqueue

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
public static <T extends INetHandler> void checkThreadAndEnqueue(final Packet<T> packetIn, final T processor, IThreadListener scheduler) throws ThreadQuickExitException
{
    if (!scheduler.isCallingFromMinecraftThread())
    {
        scheduler.addScheduledTask(new Runnable()
        {
            public void run()
            {
                packetIn.processPacket(processor);
            }
        });
        throw ThreadQuickExitException.INSTANCE;
    }
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:15,代碼來源:PacketThreadUtil.java

示例8: checkThreadAndEnqueue

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
/**
 * 1.8 ONLY: Ensures that the message is being handled on the main thread
 */
private static final <T extends AbstractMessage<T>> void checkThreadAndEnqueue (final AbstractMessage<T> msg, final MessageContext ctx) {
    IThreadListener thread = KingdomKeys.proxy.getThreadFromContext(ctx);
    if (!thread.isCallingFromMinecraftThread()) thread.addScheduledTask(new Runnable() {
        @Override
        public void run () {
            msg.process(KingdomKeys.proxy.getPlayerEntity(ctx), ctx.side);
        }
    });
}
 
開發者ID:Wehavecookies56,項目名稱:Kingdom-Keys-Re-Coded,代碼行數:13,代碼來源:AbstractMessage.java

示例9: checkThreadAndEnqueue

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
/**
 * 1.8 ONLY: Ensures that the message is being handled on the main thread
 */
private static final <T extends AbstractMessage<T>> void checkThreadAndEnqueue(final AbstractMessage<T> msg, final MessageContext ctx) {
	IThreadListener thread = Skillz.proxy.getThreadFromContext(ctx);
	// pretty much copied straight from vanilla code, see {@link PacketThreadUtil#checkThreadAndEnqueue}
	if (!thread.isCallingFromMinecraftThread()) {
		thread.addScheduledTask(new Runnable() {
			public void run() {
				msg.process(Skillz.proxy.getPlayerEntity(ctx), ctx.side);
			}
		});
	}
}
 
開發者ID:GenDeathrow,項目名稱:Skills,代碼行數:15,代碼來源:AbstractMessage.java

示例10: executeSynchronized

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
public static void executeSynchronized(ChannelHandlerContext ctx, Runnable runnable) {
	final IThreadListener thread = FMLCommonHandler.instance().getWorldThread(ctx.channel().attr(NetworkRegistry.NET_HANDLER).get());
	if (!thread.isCallingFromMinecraftThread()) {
		thread.addScheduledTask(runnable);
	} else {
		runnable.run();
	}
}
 
開發者ID:OpenMods,項目名稱:OpenModsLib,代碼行數:9,代碼來源:NetUtils.java

示例11: onClientDisconnect

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
@SubscribeEvent
public void onClientDisconnect(FMLNetworkEvent.ClientDisconnectionFromServerEvent event)
{
    IThreadListener thread = Minecraft.getMinecraft();
    if(thread.isCallingFromMinecraftThread())
    {
        onClientDisconnect();
    }
    else
    {
        thread.addScheduledTask(this::onClientDisconnect);
    }
}
 
開發者ID:iChun,項目名稱:iChunUtil,代碼行數:14,代碼來源:EventHandlerClient.java

示例12: channelRead0

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
@Override
protected void channelRead0(final ChannelHandlerContext ctx, final REQ msg) throws Exception
{
    EntityPlayer player;
    if(side.isServer())
    {
        INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
        player = ((NetHandlerPlayServer)netHandler).player;
    }
    else
    {
        player = this.getClientPlayer();
    }

    if(!msg.requiresMainThread())
    {
        executeMessage(msg, player, side, ctx);
    }
    else
    {
        IThreadListener thread = FMLCommonHandler.instance().getWorldThread(ctx.channel().attr(NetworkRegistry.NET_HANDLER).get());
        if(thread.isCallingFromMinecraftThread())
        {
            executeMessage(msg, player, side, ctx);
        }
        else
        {
            thread.addScheduledTask(() -> executeMessage(msg, player, side, ctx));
        }
    }
}
 
開發者ID:iChun,項目名稱:iChunUtil,代碼行數:32,代碼來源:PacketHandlerWrapper.java

示例13: checkThreadAndEnqueue

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
/**
 * 1.8 ONLY: Ensures that the message is being handled on the main thread
 */
private static <T extends AbstractMessage<T>> void checkThreadAndEnqueue (final AbstractMessage<T> msg, final MessageContext ctx) {
	IThreadListener thread = Bonfires.proxy.getThreadFromContext(ctx);
	if (!thread.isCallingFromMinecraftThread()) thread.addScheduledTask(() -> msg.process(Bonfires.proxy.getPlayerEntity(ctx), ctx.side));
}
 
開發者ID:Wehavecookies56,項目名稱:Bonfires,代碼行數:8,代碼來源:AbstractMessage.java

示例14: checkThreadAndEnqueue

import net.minecraft.util.IThreadListener; //導入方法依賴的package包/類
/**
 * Ensures that the message is being handled on the main thread
 */
private static final <T extends AbstractMessage<T>> void checkThreadAndEnqueue(final AbstractMessage<T> msg, final MessageContext ctx) {
	IThreadListener thread = AbyssalCraft.proxy.getThreadFromContext(ctx);
	if (!thread.isCallingFromMinecraftThread())
		thread.addScheduledTask(() -> msg.process(AbyssalCraft.proxy.getPlayerEntity(ctx), ctx.side));
}
 
開發者ID:Shinoow,項目名稱:AbyssalCraft,代碼行數:9,代碼來源:AbstractMessage.java


注:本文中的net.minecraft.util.IThreadListener.isCallingFromMinecraftThread方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。