當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。