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


Java FMLNetworkHandler类代码示例

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


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

示例1: processReadPackets

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
/**
 * Checks timeouts and processes all pending read packets.
 */
public void processReadPackets()
{
    int i = 2500;

    while (i-- >= 0 && !this.readPacketCache.isEmpty())
    {
        Packet packet = readPacketCache.poll();
        packet.processPacket(this.myNetHandler);
    }

    if (this.readPacketCache.size() > i)
    {
        this.field_98214_c.logWarning("Memory connection overburdened; after processing 2500 packets, we still have " + this.readPacketCache.size() + " to go!");
    }

    if (this.shuttingDown && this.readPacketCache.isEmpty())
    {
        this.myNetHandler.handleErrorMessage(this.shutdownReason, this.field_74439_g);
        FMLNetworkHandler.onConnectionClosed(this, this.myNetHandler.getPlayer());
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:25,代码来源:MemoryConnection.java

示例2: handleLogin

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
public void handleLogin(Packet1Login par1Packet1Login)
{
    this.mc.playerController = new PlayerControllerMP(this.mc, this);
    this.mc.statFileWriter.readStat(StatList.joinMultiplayerStat, 1);
    this.worldClient = new WorldClient(this, new WorldSettings(0L, par1Packet1Login.gameType, false, par1Packet1Login.hardcoreMode, par1Packet1Login.terrainType), par1Packet1Login.dimension, par1Packet1Login.difficultySetting, this.mc.mcProfiler, this.mc.getLogAgent());
    this.worldClient.isRemote = true;
    this.mc.loadWorld(this.worldClient);
    this.mc.thePlayer.dimension = par1Packet1Login.dimension;
    this.mc.displayGuiScreen(new GuiDownloadTerrain(this));
    this.mc.thePlayer.entityId = par1Packet1Login.clientEntityId;
    this.currentServerMaxPlayers = par1Packet1Login.maxPlayers;
    this.mc.playerController.setGameType(par1Packet1Login.gameType);
    FMLNetworkHandler.onConnectionEstablishedToServer(this, netManager, par1Packet1Login);
    this.mc.gameSettings.sendSettingsToServer();
    this.netManager.addToSendQueue(new Packet250CustomPayload("MC|Brand", ClientBrandRetriever.getClientModName().getBytes(Charsets.UTF_8)));
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:17,代码来源:NetClientHandler.java

示例3: onBlockActivated

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
/**
    * Called upon block activation (right click on the block.)
    */
@Override
   public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
   {
	if(!world.isRemote){
		if(world.getBlockMetadata(x, y, z) % 4 == 0 && !world.isBlockSolidOnSide(x, y + 1, z, DOWN))
			FMLNetworkHandler.openGui(player, StorageCraft.instance, 0, world, x, y, z);
		else if(world.getBlockMetadata(x, y, z) % 4 == 1 && !world.isBlockSolidOnSide(x, y + 1, z, DOWN))
			FMLNetworkHandler.openGui(player, StorageCraft.instance, 1, world, x, y, z);
		else if(world.getBlockMetadata(x, y, z) % 4 == 2 && !world.isBlockSolidOnSide(x, y + 1, z, DOWN))
			FMLNetworkHandler.openGui(player, StorageCraft.instance, 2, world, x, y, z);
		else if (world.getBlockMetadata(x, y, z) % 4 == 3 && !world.isBlockSolidOnSide(x, y + 1, z, DOWN))
			FMLNetworkHandler.openGui(player, StorageCraft.instance, 3, world, x, y, z);
	}
	
	return true;
   }
 
开发者ID:xandayn,项目名称:StorageCraft,代码行数:20,代码来源:BlockChestMulti.java

示例4: onBlockActivated

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
@Override
public boolean onBlockActivated(World world, int x, int y, int z,
		EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
	// We want the GUI opening to be handled on the serverside
	if (!world.isRemote) {

		/*
		 * Play to open GUI on, Mod instance, ID of the GUI, world of the
		 * player/world to open GUI, xyz coords of the block to open the GUI
		 * on
		 */
		FMLNetworkHandler.openGui(player, IceCraft.instance,
				Ids.refrigerator_gui, world, x, y, z);
	}
	// We want the GUI to open regardless whether it is the client or server
	return true;
}
 
开发者ID:Tommsy64,项目名称:Learning-to-Mod,代码行数:18,代码来源:Refrigerator.java

示例5: interactEvent

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
/**
 * For catching interactions with the Undertaker
 */
@ForgeSubscribe
public void interactEvent(EntityInteractEvent event)
{
    if (event.target instanceof EntityVillager && ((EntityVillager) event.target).getProfession() == BurialServices.getConfig().villagerID)
    {
        if (FMLCommonHandler.instance().getSide().isServer())
        {
            PacketDispatcher.sendPacketToPlayer(NetworkHelper.makeNBTPacket(BSConstants.CHANNEL_GRAVE_UPGRADE, MiscHelper.getPersistentDataTag(event.entityPlayer, BSConstants.NBT_PLAYER_GRAVE_DATA)), (Player) event.entityPlayer);
        }
        event.setCanceled(MinecraftServer.getServer().isSinglePlayer());
        FMLNetworkHandler.openGui(event.entityPlayer, BurialServices.instance, GuiHandler.undertakerID, event.entityPlayer.worldObj, 0, 0, 0);
    }
}
 
开发者ID:CCM-Modding,项目名称:CcmBurialServicesInc,代码行数:17,代码来源:EventHandler.java

示例6: onBlockActivated

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ){
	if(!world.isRemote){
		FMLNetworkHandler.openGui(player, RunesAndSilver.instance, RunesAndSilver.guiIdSilverFurnace, world, x, y, z);
	}
	
	
	return true;
}
 
开发者ID:MinecraftModArchive,项目名称:Runes-And-Silver,代码行数:9,代码来源:SilverFurnace.java

示例7: onBlockActivated

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
/**
 * Called upon block activation (right click on the block.)
 */
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer entityplayer, int par6, float par7, float par8, float par9)
{
	if(!world.isRemote)
    {
    	FMLNetworkHandler.openGui(entityplayer, mod_Rediscovered.instance, mod_Rediscovered.guiIDLockedChest, world, x, y, z);
    }
    return true;   
}
 
开发者ID:Stormister,项目名称:Rediscovered-Mod-1.6.4,代码行数:12,代码来源:BlockLockedChest.java

示例8: constructMod

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
@Subscribe
public void constructMod(FMLConstructionEvent event)
{
    try
    {
        ModClassLoader modClassLoader = event.getModClassLoader();
        modClassLoader.addFile(modSource);
        EnumSet<TickType> ticks = EnumSet.noneOf(TickType.class);
        this.gameTickHandler = new BaseModTicker(ticks, false);
        this.guiTickHandler = new BaseModTicker(ticks.clone(), true);
        Class<? extends BaseModProxy> modClazz = (Class<? extends BaseModProxy>) modClassLoader.loadBaseModClass(modClazzName);
        configureMod(modClazz, event.getASMHarvestedData());
        isNetworkMod = FMLNetworkHandler.instance().registerNetworkMod(this, modClazz, event.getASMHarvestedData());
        ModLoaderNetworkHandler dummyHandler = null;
        if (!isNetworkMod)
        {
            FMLLog.fine("Injecting dummy network mod handler for BaseMod %s", getModId());
            dummyHandler = new ModLoaderNetworkHandler(this);
            FMLNetworkHandler.instance().registerNetworkMod(dummyHandler);
        }
        Constructor<? extends BaseModProxy> ctor = modClazz.getConstructor();
        ctor.setAccessible(true);
        mod = modClazz.newInstance();
        if (dummyHandler != null)
        {
            dummyHandler.setBaseMod(mod);
        }
        ProxyInjector.inject(this, event.getASMHarvestedData(), FMLCommonHandler.instance().getSide(), new ILanguageAdapter.JavaAdapter());
    }
    catch (Exception e)
    {
        controller.errorOccurred(this, e);
        Throwables.propagateIfPossible(e);
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:36,代码来源:ModLoaderModContainer.java

示例9: modConstruction

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
@Subscribe
public void modConstruction(FMLConstructionEvent evt)
{
    FMLLog.info("Registering Forge Packet Handler");
    try
    {
        FMLNetworkHandler.instance().registerNetworkMod(new ForgeNetworkHandler(this));
        FMLLog.info("Succeeded registering Forge Packet Handler");
    }
    catch (Exception e)
    {
        FMLLog.log(Level.SEVERE, e, "Failed to register packet handler for Forge");
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:15,代码来源:ForgeDummyContainer.java

示例10: processReadPackets

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
/**
 * Checks timeouts and processes all pending read packets.
 */
public void processReadPackets()
{
    if (this.sendQueueByteLength > 2097152)
    {
        this.networkShutdown("disconnect.overflow", new Object[0]);
    }

    if (this.readPackets.isEmpty())
    {
        if (this.field_74490_x++ == 1200)
        {
            this.networkShutdown("disconnect.timeout", new Object[0]);
        }
    }
    else
    {
        this.field_74490_x = 0;
    }

    int i = 1000;

    while (i-- >= 0)
    {
        Packet packet = (Packet)this.readPackets.poll();

        if (packet != null && !this.theNetHandler.isConnectionClosed())
        {
            packet.processPacket(this.theNetHandler);
        }
    }

    this.wakeThreads();

    if (this.isTerminating && this.readPackets.isEmpty())
    {
        this.theNetHandler.handleErrorMessage(this.terminationReason, this.shutdownDescription);
        FMLNetworkHandler.onConnectionClosed(this, this.theNetHandler.getPlayer());
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:43,代码来源:TcpConnection.java

示例11: handleMapData

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
@Override

    /**
     * Contains logic for handling packets containing arbitrary unique item data. Currently this is only for maps.
     */
    public void handleMapData(Packet131MapData par1Packet131MapData)
    {
        FMLNetworkHandler.handlePacket131Packet(this, par1Packet131MapData);
    }
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:10,代码来源:NetServerHandler.java

示例12: NetClientHandler

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
public NetClientHandler(Minecraft par1Minecraft, String par2Str, int par3) throws IOException
{
    this.mc = par1Minecraft;
    Socket socket = new Socket(InetAddress.getByName(par2Str), par3);
    this.netManager = new TcpConnection(par1Minecraft.getLogAgent(), socket, "Client", this);
    FMLNetworkHandler.onClientConnectionToRemoteServer(this, par2Str, par3, this.netManager);
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:8,代码来源:NetClientHandler.java

示例13: quitWithPacket

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
public void quitWithPacket(Packet par1Packet)
{
    if (!this.disconnected)
    {
        this.netManager.addToSendQueue(par1Packet);
        this.netManager.serverShutdown();
        FMLNetworkHandler.onConnectionClosed(this.netManager, this.getPlayer());
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:10,代码来源:NetClientHandler.java

示例14: handleChat

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
public void handleChat(Packet3Chat par1Packet3Chat)
{
    par1Packet3Chat = FMLNetworkHandler.handleChatMessage(this, par1Packet3Chat);
    if (par1Packet3Chat == null)
    {
        return;
    }
    ClientChatReceivedEvent event = new ClientChatReceivedEvent(par1Packet3Chat.message);
    if (!MinecraftForge.EVENT_BUS.post(event) && event.message != null)
    {
        this.mc.ingameGUI.getChatGUI().printChatMessage(ChatMessageComponent.createFromJson(event.message).toStringWithFormatting(true));
    }
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:14,代码来源:NetClientHandler.java

示例15: onBlockActivated

import cpw.mods.fml.common.network.FMLNetworkHandler; //导入依赖的package包/类
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float a, float b, float c)
{
	if (!world.isRemote){
		FMLNetworkHandler.openGui(player, KingdomKeys.instance, 0, world, x, y, z);
	}
	return true;
}
 
开发者ID:Wehavecookies56,项目名称:Kingdom-Keys,代码行数:8,代码来源:BlockSynthesis.java


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