本文整理匯總了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;
}