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