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


Java INetworkManager類代碼示例

本文整理匯總了Java中net.minecraft.network.INetworkManager的典型用法代碼示例。如果您正苦於以下問題:Java INetworkManager類的具體用法?Java INetworkManager怎麽用?Java INetworkManager使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: onPacketData

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player) {
    if (player instanceof EntityPlayerMP) {
        EntityPlayerMP playerMP = (EntityPlayerMP) player;
        RemoteKey rk = new RemoteKey(packet);
        
        Map<String, Boolean> playerKeyMap;
        if (!playerKeys.containsKey(playerMP.username)) {
            playerKeyMap = new HashMap<String, Boolean>();
            playerKeys.put(playerMP.username, playerKeyMap);
        } else {
            playerKeyMap = playerKeys.get(playerMP.username);
        }
        playerKeyMap.put(rk.getName(), rk.isDown());
    }
}
 
開發者ID:NovaViper,項目名稱:ZeroQuest,代碼行數:17,代碼來源:RemoteKeyPacketHandler.java

示例2: onDataPacket

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void onDataPacket( INetworkManager net, Packet132TileEntityData packet )
{
	switch( packet.actionType )
	{
		case 0:
		{
			this.readFromNBT( packet.data );
worldObj.markBlockForUpdate( xCoord, yCoord, zCoord );
			break;
		}
		default:
		{
			break;
		}
	}
}
 
開發者ID:dan200,項目名稱:Billund,代碼行數:18,代碼來源:TileEntityBillund.java

示例3: connectionOpened

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager)
{
	System.out.println("Hello !");
	if (netClientHandler instanceof NetClientHandler)
	{
		NetClientHandler nch = (NetClientHandler) netClientHandler;
		INetworkManager netmanager = nch.getNetManager();
		
		System.out.println("Hello 2 !");
		
		if (netmanager instanceof TcpConnection)
		{
			System.out.println("Hello 3 !");
			((TcpConnection) netmanager).setNetHandler(new WDLNetClientHandler(nch));
		}
	}
}
 
開發者ID:xurei,項目名稱:forge_world_downloader,代碼行數:19,代碼來源:WDLConnectionHandler.java

示例4: onPacketData

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
    EntityPlayer sender = (EntityPlayer) player;

    if (packet.channel.equals(Resources.PACKET_CHANNEL))
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));
        int id = -1;

        try
        {
            id = data.readInt();

        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
 
開發者ID:Stormister,項目名稱:Rediscovered-Mod-1.6.4,代碼行數:22,代碼來源:ServerPacketHandler.java

示例5: onPacketData

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
    if (packet.channel.equals(Resources.PACKET_CHANNEL))
    {
        DataInputStream data = new DataInputStream(new ByteArrayInputStream(packet.data));

        try
        {
            int id = -1;
            id = data.readInt();
            EntityPlayer p = (EntityPlayer) player;

        }
        catch (IOException e)
        {
            e.printStackTrace();
        }
    }
}
 
開發者ID:Stormister,項目名稱:Rediscovered-Mod-1.6.4,代碼行數:21,代碼來源:ClientPacketHandler.java

示例6: execute

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    byte[] allData = Bytes.concat(partials);
    GameData.initializeServerGate(1);
    try
    {
        NBTTagCompound serverList = CompressedStreamTools.func_74792_a(allData);
        NBTTagList list = serverList.func_74761_m("List");
        Set<ItemData> itemData = GameData.buildWorldItemData(list);
        GameData.validateWorldSave(itemData);
        MapDifference<Integer, ItemData> serverDifference = GameData.gateWorldLoadingForValidation();
        if (serverDifference!=null)
        {
            FMLCommonHandler.instance().disconnectIDMismatch(serverDifference, netHandler, network);

        }
    }
    catch (IOException e)
    {
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:23,代碼來源:ModIdMapPacket.java

示例7: execute

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void execute(INetworkManager network, FMLNetworkHandler handler, NetHandler netHandler, String userName)
{
    NetworkModHandler nmh = handler.findNetworkModHandler(networkId);
    ModContainer mc = nmh.getContainer();

    EntityRegistration registration = EntityRegistry.instance().lookupModSpawn(mc, modEntityId);
    if (registration == null || registration.getEntityClass() == null)
    {
        FMLLog.log(Level.WARNING, "Missing mod entity information for %s : %d", mc.getModId(), modEntityId);
        return;
    }


    Entity entity = FMLCommonHandler.instance().spawnEntityIntoClientWorld(registration, this);
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:17,代碼來源:EntitySpawnPacket.java

示例8: onPacketData

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void onPacketData(INetworkManager manager,
		Packet250CustomPayload packet, Player player) {
	if (packet.channel.equals("UCTS_TileEntity")) {
		handleTEPacket(manager, packet, player);
	}
	else if (packet.channel.equals("UCTS_Buttons")) {
		handleButtonsPacket(manager, packet, player);
	}
	else if (packet.channel.equals("UCTS_TE_Request")){
		handleTERequest(manager, packet, player);
	}
}
 
開發者ID:TED-996,項目名稱:UniversalCoinsMod,代碼行數:14,代碼來源:UCPacketHandler.java

示例9: handleTERequest

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
private void handleTERequest(INetworkManager manager, Packet250CustomPayload packet, Player player) {
	// Packet always player-to-server
	EntityPlayer entityPlayer = (EntityPlayer) player;
	World world = entityPlayer.worldObj;
	if (world.isRemote) {
		Minecraft.getMinecraft().getLogAgent()
				.logWarning("UniversalCoins: TE Request packet received by client.");
	}
	int x = 0, y = 0, z = 0, dimension;
	DataInputStream stream = new DataInputStream(new ByteArrayInputStream(
			packet.data));
	try {
		x = stream.readInt();
		y = stream.readInt();
		z = stream.readInt();
		dimension = stream.readInt();
	} catch (Exception ex) {
		ex.printStackTrace();
		return;
	}
	if (world.getWorldInfo().getVanillaDimension() != dimension) {
		return;
	}
	TileEntity tEntity = world.getBlockTileEntity(x, y, z);
	if (tEntity != null && tEntity instanceof UCTileEntity) {
		UCTileEntity ucTileEntity = (UCTileEntity) tEntity;
		ucTileEntity.dispatchPackage();
	}

}
 
開發者ID:TED-996,項目名稱:UniversalCoinsMod,代碼行數:31,代碼來源:UCPacketHandler.java

示例10: onDataPacket

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
public void onDataPacket(INetworkManager net, Packet132TileEntityData pkt)
{
    NBTTagList nbttaglist = pkt.data.getTagList("contents");
    contents = new ItemStack[nbttaglist.tagCount()];
    for (int i = 0; i < nbttaglist.tagCount(); ++i)
    {
        contents[i] = ItemStack.loadItemStackFromNBT((NBTTagCompound) nbttaglist.tagAt(i));
    }
    username = pkt.data.getString("username");
    holding = ItemStack.loadItemStackFromNBT(pkt.data.getCompoundTag("holding"));
    text = pkt.data.getString("text").split("\n");
    age = pkt.data.getInteger("age");
}
 
開發者ID:CCM-Modding,項目名稱:CcmBurialServicesInc,代碼行數:14,代碼來源:GraveTE.java

示例11: onPacketData

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload _packet, Player player) 
{
	try
	{
		BillundPacket packet = BillundPacket.parse( _packet.data );
		Billund.handlePacket( packet, player );
	}
	catch( Exception e )
	{
		// Something failed, ignore it
		//e.printStackTrace();
	}	
}
 
開發者ID:dan200,項目名稱:Billund,代碼行數:15,代碼來源:PacketHandler.java

示例12: onPacketData

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void onPacketData(INetworkManager manager,
		Packet250CustomPayload packet, Player player) {

	DataInputStream inputStream = new DataInputStream(new ByteArrayInputStream(packet.data));
	byte packetType;

	
	try {
		packetType = inputStream.readByte();
	} catch (IOException e) {
		e.printStackTrace();
		return;
	}

	if(packet.channel.equals("GenericClass")){
		switch(packetType) {
		case EXTENDED_PROPERTIES: handleClass(packet, player, inputStream); break;
		case OPEN_SERVER_GUI: handleOpenServerGui(packet, (EntityPlayer) player, inputStream); break;
		case EXTENDED_SPEC: handleSpec(packet, player, inputStream); break;
		case EXTENDED_WEAPONS: handleWeapon(packet, player, inputStream); break;
		case EXTENDED_STATS: handleStats(packet, player, inputStream); break;
		case EXTENDED_CHAIN: handleChain(packet, player, inputStream); break;
		default: System.out.println("[PACKET][WARNING] Unknown packet type " + packetType);
		}
	}
}
 
開發者ID:Unrelentless,項目名稱:FantasyCraft-Mod,代碼行數:28,代碼來源:PacketHandler.java

示例13: onDataPacket

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void onDataPacket(INetworkManager manager, Packet132TileEntityData packet) {
	switch (packet.actionType) {
		case DATA_CLIENT:
			readFromNBT(packet.data);
			break;
		case DATA_POKE:
			onPoke();
			break;
		case DATA_DATA:
			onData(packet.data);
			break;
	}
}
 
開發者ID:dmillerw,項目名稱:Package,代碼行數:15,代碼來源:TileCore.java

示例14: execute

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
@Override
public void execute(INetworkManager network, EntityPlayer player)
{
    if (!(player instanceof EntityPlayerMP))
    {
        if (!DimensionManager.isDimensionRegistered(dimensionId))
        {
            DimensionManager.registerDimension(dimensionId, providerId);
        }
    }
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:12,代碼來源:DimensionRegisterPacket.java

示例15: consumePart

import net.minecraft.network.INetworkManager; //導入依賴的package包/類
private ForgePacket consumePart(INetworkManager network, byte[] data)
{
    if (partTracker == null)
    {
        partTracker = new MapMaker().weakKeys().weakValues().makeMap();
    }
    if (!partTracker.containsKey(network))
    {
        partTracker.put(network, make());
    }

    ForgePacket pkt = partTracker.get(network);

    ByteArrayDataInput bdi = ByteStreams.newDataInput(data);
    int chunkIdx = UnsignedBytes.toInt(bdi.readByte());
    int chunkTotal = UnsignedBytes.toInt(bdi.readByte());
    int chunkLength = bdi.readInt();

    if (pkt.partials == null)
    {
        pkt.partials = new byte[chunkTotal][];
    }

    pkt.partials[chunkIdx] = new byte[chunkLength];
    bdi.readFully(pkt.partials[chunkIdx]);
    for (int i = 0; i < pkt.partials.length; i++)
    {
        if (pkt.partials[i] == null)
        {
            return null;
        }
    }

    return pkt;
}
 
開發者ID:HATB0T,項目名稱:RuneCraftery,代碼行數:36,代碼來源:ForgePacket.java


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