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