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


Java NetworkRegistry类代码示例

本文整理汇总了Java中net.minecraftforge.fml.common.network.NetworkRegistry的典型用法代码示例。如果您正苦于以下问题:Java NetworkRegistry类的具体用法?Java NetworkRegistry怎么用?Java NetworkRegistry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: checkModList

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
public static String checkModList(Map<String,String> listData, Side side)
{
    List<ModContainer> rejects = Lists.newArrayList();
    for (Entry<ModContainer, NetworkModHolder> networkMod : NetworkRegistry.INSTANCE.registry().entrySet())
    {
        boolean result = networkMod.getValue().check(listData, side);
        if (!result)
        {
            rejects.add(networkMod.getKey());
        }
    }
    if (rejects.isEmpty())
    {
        return null;
    }
    else
    {
        FMLLog.info("Rejecting connection %s: %s", side, rejects);
        return String.format("Mod rejections %s",rejects);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:22,代码来源:FMLNetworkHandler.java

示例2: serverToClientHandshake

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
public void serverToClientHandshake(EntityPlayerMP player)
{
    this.player = player;
    Boolean fml = this.manager.channel().attr(NetworkRegistry.FML_MARKER).get();
    if (fml != null && fml)
    {
        //FML on client, send server hello
        //TODO: Make this cleaner as it uses netty magic 0.o
        insertIntoChannel();
    }
    else
    {
        serverInitiateHandshake();
        FMLLog.info("Connection received without FML marker, assuming vanilla.");
        this.completeServerSideConnection(ConnectionType.VANILLA);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:18,代码来源:NetworkDispatcher.java

示例3: channelRead0

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的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

示例4: preInit

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event){
	ModMetadata modMeta = event.getModMetadata();
	modMeta.authorList = Arrays.asList(new String[] { "Subaraki" });
	modMeta.autogenerated = false;
	modMeta.credits = "";
	modMeta.description = "Thermo Efficient Pots and Pans";
	modMeta.url = "https://github.com/ArtixAllMighty/ExSartagine/wiki";
	
	instance = this;
	
	ExSartagineBlock.load();
	ExSartagineItems.load();
	
	proxy.registerTileEntityAndRenderer();
	proxy.registerRenders();
	
	NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
	
	new Recipes();
	
}
 
开发者ID:ArtixAllMighty,项目名称:ExSartagine,代码行数:23,代码来源:ExSartagine.java

示例5: preInit

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
public static void preInit()
{
	INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(HarshenCastle.MODID);
	registerMessage(MessagePacketPlayerHasAccess.class, Side.CLIENT);
	registerMessage(MessagePacketTileEntityBloodPlacerUpdated.class, Side.CLIENT);
	registerMessage(MessagePacketOpenInv.class, Side.SERVER);
	registerMessage(MessageSendPlayerInvToClient.class, Side.CLIENT);
	registerMessage(MessagePacketPlayerTeleportEffects.class, Side.CLIENT);
	registerMessage(MessagePacketRingUpdate.class, Side.SERVER);
	registerMessage(MessagePacketSetItemInSlot.class, Side.CLIENT);
	registerMessage(MessagePacketUpdateXrayBlock.class, Side.SERVER);
	registerMessage(MessagePacketSummonFirework.class, Side.SERVER);
	registerMessage(MessagePacketRequestInv.class, Side.SERVER);
	registerMessage(MessagePacketSpawnItemParticles.class, Side.CLIENT);
	registerMessage(MessagePacketSpawnBloodParticle.class, Side.CLIENT);
	registerMessage(MessagePacketKillAllWithTag.class, Side.CLIENT);
	registerMessage(MessagePacketHitWithRange.class, Side.SERVER);
	registerMessage(MessagePacketReviveInventory.class, Side.CLIENT);
	registerMessage(MessagePacketUpdateComplexEntity.class, Side.CLIENT);
	registerMessage(MessagePacketUpdateCauldron.class, Side.CLIENT);
	registerMessage(MessagePacketForceCauldronUpdate.class, Side.CLIENT);
	registerMessage(MessagePacketForceCauldronUpdate.class, Side.SERVER);
}
 
开发者ID:kenijey,项目名称:harshencastle,代码行数:24,代码来源:HarshenNetwork.java

示例6: onCastTick

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
@Override
public void onCastTick(World world, EntityPlayer player, ItemStack stack) {
	if (!world.isRemote) {
		BlockPos centerPos = player.getPosition();
		AxisAlignedBB area = new AxisAlignedBB(centerPos).expandXyz(3F);
		for (Entity entity : world.getEntitiesWithinAABBExcludingEntity(player, area)) {
			if (entity instanceof EntityLivingBase) {
				WorldServer worldServer = (WorldServer) world;
				if (player.getItemInUseCount() % 10 == 0 && consumePower(player)) {
					MessageSoulDrainFX message = new MessageSoulDrainFX(entity.posX,
							entity.posY + (entity.height / 2.0F), entity.posZ, player.posX,
							player.posY + (player.height / 2.0F), player.posZ);
					PacketHandler.INSTANCE.sendToAllAround(message, new NetworkRegistry.TargetPoint(
							player.dimension, player.posX, player.posY, player.posZ, 128));
					entity.attackEntityFrom(DamageSource.magic, 1);
					world.spawnEntity(new EntityXPOrb(world, entity.posX, entity.posY + 0.5, entity.posZ, 1));
				}
			}
		}
	}
}
 
开发者ID:the-realest-stu,项目名称:Infernum,代码行数:22,代码来源:SpellSoulDrain.java

示例7: processPacket

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
/**
 * Passes this Packet on to the NetHandler for processing.
 */
@Override
public void processPacket(INetHandler inethandler)
{
    this.netHandler = inethandler;
    EmbeddedChannel internalChannel = NetworkRegistry.INSTANCE.getChannel(this.channel, this.target);
    if (internalChannel != null)
    {
        internalChannel.attr(NetworkRegistry.NET_HANDLER).set(this.netHandler);
        try
        {
            if (internalChannel.writeInbound(this))
            {
                badPackets.add(this.channel);
                if (badPackets.size() % packetCountWarning == 0)
                {
                    FMLLog.severe("Detected ongoing potential memory leak. %d packets have leaked. Top offenders", badPackets.size());
                    int i = 0;
                    for (Entry<String> s  : Multisets.copyHighestCountFirst(badPackets).entrySet())
                    {
                        if (i++ > 10) break;
                        FMLLog.severe("\t %s : %d", s.getElement(), s.getCount());
                    }
                }
            }
            internalChannel.inboundMessages().clear();
        }
        catch (FMLNetworkException ne)
        {
            FMLLog.log(Level.ERROR, ne, "There was a network exception handling a packet on channel %s", channel);
            dispatcher.rejectHandshake(ne.getMessage());
        }
        catch (Throwable t)
        {
            FMLLog.log(Level.ERROR, t, "There was a critical exception handling a packet on channel %s", channel);
            dispatcher.rejectHandshake("A fatal error has occurred, this connection is terminated");
        }
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:42,代码来源:FMLProxyPacket.java

示例8: onInit

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
@Mod.EventHandler
public void onInit(FMLInitializationEvent ev) {
    info("Randores is Initializing...",
            "Sending handler message to WAILA.");
    FMLInterModComms.sendMessage("waila", "register", "com.gmail.socraticphoenix.randores.waila.RandoresWailaHandler.callbackRegister");
    if (Loader.isModLoaded("waila")) {
        info("WAILA was found and should have receieved the handler message.");
    } else {
        info("WAILA wasn't found. The handler message will be ignored.");
    }

    info("Registering up GUI handler and world generators...");
    NetworkRegistry.INSTANCE.registerGuiHandler(this, new RandoresGuiHandler());
    GameRegistry.registerWorldGenerator(new RandoresWorldGenerator(), 10);
    GameRegistry.registerWorldGenerator(new RandoresAltarGenerator(), -100);
    info("Registered GUI hander and world generators.", "Calling proxy Initialization...");
    Randores.PROXY.initSided(ev);
    info("Finished Initialization.");
}
 
开发者ID:Randores,项目名称:Randores2,代码行数:20,代码来源:Randores.java

示例9: init

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
public void init(FMLInitializationEvent e) {
        MinecraftForge.EVENT_BUS.register(new ForgeEventHandlers());
        NetworkRegistry.INSTANCE.registerGuiHandler(InteractionWheel.instance, new GuiProxy());

        InteractionWheel.registry.register(new RotateBlockAction());
        InteractionWheel.registry.register(new SearchWheelAction());
        InteractionWheel.registry.register(new DumpWheelAction());
        InteractionWheel.registry.register(new Dump1WheelAction());
        InteractionWheel.registry.register(new DumpSimilarWheelAction());
        InteractionWheel.registry.register(new DumpSimilarInventoryAction());
        InteractionWheel.registry.register(new DumpOresAction());
        InteractionWheel.registry.register(new DumpBlocksAction());
        InteractionWheel.registry.register(new ExtractWheelAction());
        InteractionWheel.registry.register(new PickToolWheelAction());
//        for (int i = 0 ; i < 30 ; i++) {
//            InteractionWheel.registry.register(new DummyWheelAction("std.dummy" + i));
//        }
    }
 
开发者ID:McJty,项目名称:interactionwheel,代码行数:19,代码来源:CommonProxy.java

示例10: init

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
@EventHandler
public void init(FMLInitializationEvent event) {
	proxy.init(event);

	NetworkRegistry.INSTANCE.registerGuiHandler(Currency.INSTANCE, new GuiHandler());

	AccountCapability.register();
	CartCapability.register();

	PacketDispatcher.registerPackets();

	FMLInterModComms.sendMessage("waila", "register", "com.zundrel.currency.common.compat.waila.CurrencyWailaProvider.callbackRegister");

	GameRegistry.registerTileEntity(TileEntityShopController.class, ModInfo.MODID + ":" + "shop_controller");
	GameRegistry.registerTileEntity(TileEntityDisplay.class, ModInfo.MODID + ":" + "display");
	GameRegistry.registerTileEntity(TileEntityStockCrate.class, ModInfo.MODID + ":" + "stock_crate");
}
 
开发者ID:Zundrel,项目名称:Never-Enough-Currency,代码行数:18,代码来源:Currency.java

示例11: channelRead0

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的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

示例12: setup

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
public static void setup()
{
    NetworkRegistry.INSTANCE.registerGuiHandler(PurMag.INSTANCE, new GuiHandler());

    INSTANCE.registerMessage(CPacketSyncEntryStore.Handler.class, CPacketSyncEntryStore.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(CPacketDisplayMessage.Handler.class, CPacketDisplayMessage.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(CPacketSyncSif.Handler.class, CPacketSyncSif.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(CPacketDesyncSif.Handler.class, CPacketDesyncSif.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(SPacketUseSipAmulet.Handler.class, SPacketUseSipAmulet.class, id++, Side.SERVER);
    INSTANCE.registerMessage(CPacketSpawnSipParticle.Handler.class, CPacketSpawnSipParticle.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(SPacketDoneTranslation.Handler.class, SPacketDoneTranslation.class, id++, Side.SERVER);
    INSTANCE.registerMessage(CPacketSpawnParticle.Handler.class, CPacketSpawnParticle.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(CPacketSyncAura.Handler.class, CPacketSyncAura.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(SPacketLock.Handler.class, SPacketLock.class, id++, Side.SERVER);
    INSTANCE.registerMessage(SPacketUnlock.Handler.class, SPacketUnlock.class, id++, Side.SERVER);
    INSTANCE.registerMessage(CPacketUnlockResponse.Handler.class, CPacketUnlockResponse.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(SPacketCheckMicroscopeResearch.Handler.class, SPacketCheckMicroscopeResearch.class, id++, Side.SERVER);
    INSTANCE.registerMessage(CPacketCheckMicroscopeResearchResponse.Handler.class, CPacketCheckMicroscopeResearchResponse.class, id++, Side.CLIENT);
    INSTANCE.registerMessage(CPacketSpawnMultiblockParticles.Handler.class, CPacketSpawnMultiblockParticles.class, id++, Side.CLIENT);
}
 
开发者ID:PearXTeam,项目名称:PurificatiMagicae,代码行数:21,代码来源:NetworkManager.java

示例13: init

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
@Mod.EventHandler
public void init(FMLInitializationEvent event) {
    CapabilityExtendedHealthSystem.register();

    int i = 0;
    NETWORKING = NetworkRegistry.INSTANCE.newSimpleChannel(MODID);
    NETWORKING.registerMessage(MessageReceiveDamage.Handler.class, MessageReceiveDamage.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessageApplyHealingItem.Handler.class, MessageApplyHealingItem.class, ++i , Side.SERVER);
    NETWORKING.registerMessage(MessageReceiveConfiguration.Handler.class, MessageReceiveConfiguration.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessageApplyAbsorption.Handler.class, MessageApplyAbsorption.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessageAddHealth.Handler.class, MessageAddHealth.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessagePlayHurtSound.Handler.class, MessagePlayHurtSound.class, ++i, Side.CLIENT);
    NETWORKING.registerMessage(MessageClientUpdate.Handler.class, MessageClientUpdate.class, ++i, Side.SERVER);
    NETWORKING.registerMessage(MessageResync.Handler.class, MessageResync.class, ++i, Side.CLIENT);
    MessageReceiveConfiguration.validate();

    if (Loader.isModLoaded("morpheus")) {
        enableMorpheusCompat = true;
        logger.info("Morpheus present - enabling compatibility module");
        MorpheusHelper.register();
    }

    RegistryManager.registerDefaults();
    checkEarlyExit();
}
 
开发者ID:ichttt,项目名称:FirstAid,代码行数:26,代码来源:FirstAid.java

示例14: onBlockPlacedBy

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
	if(worldIn.isRemote || !stack.hasTagCompound())
		return;
	
	TileEntity te = worldIn.getTileEntity(pos);
	
	if(te instanceof TileEntityXPBlock)
	{
		NBTTagCompound tag = stack.getTagCompound().getCompoundTag("BlockEntityTag");

		tag.setInteger("x", pos.getX());
		tag.setInteger("y", pos.getY());
		tag.setInteger("z", pos.getZ());
		((TileEntityXPBlock)te).readFromNBT(tag);
		((TileEntityXPBlock)te).markDirty();
		GlobalXP.network.sendToAllAround(new SPacketUpdateXPBlock((TileEntityXPBlock)te), new NetworkRegistry.TargetPoint(worldIn.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), 64));
	}
}
 
开发者ID:bl4ckscor3,项目名称:GlobalXP,代码行数:21,代码来源:XPBlock.java

示例15: preInit

import net.minecraftforge.fml.common.network.NetworkRegistry; //导入依赖的package包/类
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
    logger = event.getModLog();

    config = new Configuration(event.getSuggestedConfigurationFile());
    doConfig();

    int id = 1; // Don't use 0, more easy debug.
    snw = NetworkRegistry.INSTANCE.newSimpleChannel(MOD_ID);

    snw.registerMessage(Request.Handler.class, Request.class, id++, Side.SERVER);
    snw.registerMessage(Data.Handler.class, Data.class, id++, Side.CLIENT);

    proxy.preInit();
}
 
开发者ID:dries007,项目名称:DebugServerInfo,代码行数:17,代码来源:DebugServerInfo.java


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