当前位置: 首页>>代码示例>>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;未经允许,请勿转载。