本文整理汇总了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());
}
}
示例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;
}
}
}
示例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));
}
}
}
示例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();
}
}
}
示例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();
}
}
}
示例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)
{
}
}
示例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);
}
示例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);
}
}
示例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();
}
}
示例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");
}
示例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();
}
}
示例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);
}
}
}
示例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;
}
}
示例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);
}
}
}
示例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;
}