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


Java Packet250CustomPayload类代码示例

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


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

示例1: requestCoinSumPackage

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
void requestCoinSumPackage(){
	Packet250CustomPayload packet = new Packet250CustomPayload();
	ByteArrayOutputStream stream = new ByteArrayOutputStream(16);
	DataOutputStream outputStream = new DataOutputStream(stream);
	try {
		outputStream.writeInt(xCoord);
		outputStream.writeInt(yCoord);
		outputStream.writeInt(zCoord);
		outputStream.writeInt(this.worldObj.getWorldInfo().getVanillaDimension());
	} catch (Exception ex) {
		ex.printStackTrace();
	}
	packet.channel = "UCTS_TE_Request";
	packet.data = stream.toByteArray();
	packet.length = stream.size();
	PacketDispatcher.sendPacketToServer(packet);
}
 
开发者ID:TED-996,项目名称:UniversalCoinsMod,代码行数:18,代码来源:UCTileEntity.java

示例2: onPacketData

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
@Override
public void onPacketData(INetworkManager manager, Packet250CustomPayload packet, Player player)
{
    try
    {
        if (packet.channel.equals(CHANNEL_GRAVE_UPGRADE))
        {
            if (FMLCommonHandler.instance().getEffectiveSide().isClient())
            {
                if (Minecraft.getMinecraft().currentScreen instanceof GraveUpgradeGui)
                {
                    ((GraveUpgradeGui) (Minecraft.getMinecraft().currentScreen)).updateInfoFromPacket(NetworkHelper.byteArrayToNBT(packet.data));
                }
            }
            else
            {
                MiscHelper.setPersistentDataTag((EntityPlayer) player, BSConstants.NBT_PLAYER_GRAVE_DATA, NetworkHelper.byteArrayToNBT(packet.data));
            }
        }
    }
    catch (Exception e)
    {
        e.printStackTrace();
    }
}
 
开发者ID:CCM-Modding,项目名称:CcmBurialServicesInc,代码行数:26,代码来源:PacketHandler.java

示例3: getEntityPacketInteger

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getEntityPacketInteger(Entity entity, int dat)
{
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int id = entity.entityId;
	try {
		dos.writeInt(1);
		dos.writeInt(id);
		dos.writeInt(dat);
	} catch (IOException e) {
		System.out.println("Failed to send Entity packet");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:20,代码来源:PacketManagerMF.java

示例4: getEntityPacketIntegerArray

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getEntityPacketIntegerArray(Entity entity, int[] dat)
{
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int id = entity.entityId;
	try {
		dos.writeInt(1);
		dos.writeInt(id);
		for(int a = 0; a < dat.length; a ++)
		dos.writeInt(dat[a]);
	} catch (IOException e) {
		System.out.println("Failed to send Entity packet");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:21,代码来源:PacketManagerMF.java

示例5: getEntityPacketDoubleArray

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getEntityPacketDoubleArray(Entity entity, double[] dat)
{
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int id = entity.entityId;
	try {
		dos.writeInt(1);
		dos.writeInt(id);
		for(int a = 0; a < dat.length; a ++)
		dos.writeDouble(dat[a]);
	} catch (IOException e) {
		System.out.println("Failed to send Entity packet");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:21,代码来源:PacketManagerMF.java

示例6: getEntityPacketMotionArray

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getEntityPacketMotionArray(Entity entity, int moveID, double[] dat)
{
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int id = entity.entityId;
	try {
		dos.writeInt(1);
		dos.writeInt(id);
		dos.writeInt(moveID);
		for(int a = 0; a < dat.length; a ++)
		dos.writeDouble(dat[a]);
	} catch (IOException e) {
		System.out.println("Failed to send Entity packet");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:22,代码来源:PacketManagerMF.java

示例7: getPacketInteger

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getPacketInteger(TileEntity tile, int data) {
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int x = tile.xCoord;
	int y = tile.yCoord;
	int z = tile.zCoord;
	int dat = data;
	try {
		dos.writeInt(0);
		dos.writeInt(x);
		dos.writeInt(y);
		dos.writeInt(z);
		dos.writeInt(dat);
	} catch (IOException e) {
		System.out.println("Failed to send tile Entity packet for tile entity");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:24,代码来源:PacketManagerMF.java

示例8: getPacketMFResult

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getPacketMFResult(TileEntity tile, ItemStack item)
{
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int x = tile.xCoord;
	int y = tile.yCoord;
	int z = tile.zCoord;
	try {
		dos.writeInt(6);
		dos.writeInt(x);
		dos.writeInt(y);
		dos.writeInt(z);
		writeItemStack(item, dos);
	} catch (IOException e) {
		System.out.println("Failed to send tile Entity packet for tile entity");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:24,代码来源:PacketManagerMF.java

示例9: getPacketIntegerArray

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getPacketIntegerArray(TileEntity tile, int[] data) {
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int x = tile.xCoord;
	int y = tile.yCoord;
	int z = tile.zCoord;
	try {
		dos.writeInt(0);
		dos.writeInt(x);
		dos.writeInt(y);
		dos.writeInt(z);
		for(int i = 0; i < data.length ; i ++)
		dos.writeInt(data[i]);
	} catch (IOException e) {
		System.out.println("Failed to send tile Entity packet for tile entity");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:24,代码来源:PacketManagerMF.java

示例10: getEntityRenamePacket

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getEntityRenamePacket(INameableEntity namer, String dat)
{
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int id = namer.getEntityID();
	try {
		dos.writeInt(3);
		dos.writeInt(id);
		dos.writeInt(dat.length());
		dos.writeChars(dat);
	} catch (IOException e) {
		System.out.println("Failed to send Name packet");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:22,代码来源:PacketManagerMF.java

示例11: getArrowItemPacket

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getArrowItemPacket(EntityPlayer player, int ID, int Meta)
{
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	
	int playerID = player.entityId;
	try {
		dos.writeInt(5);
		dos.writeInt(playerID);
		dos.writeInt(ID);
		dos.writeInt(Meta);
	} catch (IOException e) {
		System.out.println("Failed to send Load Arrow packet");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:23,代码来源:PacketManagerMF.java

示例12: getPacketItemStackArray

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static Packet getPacketItemStackArray(TileEntity tile, int slot, ItemStack item)
{
	ByteArrayOutputStream bos = new ByteArrayOutputStream(140);
	DataOutputStream dos = new DataOutputStream(bos);
	int x = tile.xCoord;
	int y = tile.yCoord;
	int z = tile.zCoord;
	try {
		dos.writeInt(2);
		dos.writeInt(x);
		dos.writeInt(y);
		dos.writeInt(z);
		
		dos.writeInt(slot);
		writeItemStack(item, dos);
	} catch (IOException e) {
		System.out.println("Failed to send tile Entity packet for tile entity");
	}
	Packet250CustomPayload pkt = new Packet250CustomPayload();
	pkt.channel = "MineFantasy";
	pkt.data = bos.toByteArray();
	pkt.length = bos.size();
	pkt.isChunkDataPacket = true;
	return pkt;
}
 
开发者ID:TheAwesomeGem,项目名称:MineFantasy,代码行数:26,代码来源:PacketManagerMF.java

示例13: mousePressed

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
@Override
public boolean mousePressed(Minecraft minecraft, int par2, int par3)
{
	if (renderID != 0)
		return super.mousePressed(minecraft, par2, par3);

	this.enabled = !super.mousePressed(minecraft, par2, par3);
	if (!this.enabled && this.renderID == 0)
	{
		Packet250CustomPayload packet = new Packet250CustomPayload();
		packet.length = 1;
		packet.data = new byte[] { 0 };
		packet.channel = Reference.CHANNEL;
		PacketDispatcher.sendPacketToServer(packet);
	}
	return !this.enabled;
}
 
开发者ID:tterrag1098,项目名称:RecipeIGE,代码行数:18,代码来源:SmallButton.java

示例14: onPacketData

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的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

示例15: onPacketData

import net.minecraft.network.packet.Packet250CustomPayload; //导入依赖的package包/类
public static void onPacketData(INetworkManager manager, Packet250CustomPayload packet, EntityPlayer player) {
	if (!packet.channel.equals(channel))
		return;
	packet.channel=channelDummy;
	

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

	try {
		byte index = inputStream.readByte();

		if (index >= items.size()) {
			return;
		}

		items.get(index).onData(inputStream, player);
	} catch (IOException e) {
		e.printStackTrace();
	}
}
 
开发者ID:delta534,项目名称:Chisel,代码行数:21,代码来源:PacketHandler.java


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