本文整理汇总了Java中net.minecraft.network.PacketBuffer.readVarIntFromBuffer方法的典型用法代码示例。如果您正苦于以下问题:Java PacketBuffer.readVarIntFromBuffer方法的具体用法?Java PacketBuffer.readVarIntFromBuffer怎么用?Java PacketBuffer.readVarIntFromBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.network.PacketBuffer
的用法示例。
在下文中一共展示了PacketBuffer.readVarIntFromBuffer方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.mapId = buf.readVarIntFromBuffer();
this.mapScale = buf.readByte();
this.mapVisiblePlayersVec4b = new Vec4b[buf.readVarIntFromBuffer()];
for (int i = 0; i < this.mapVisiblePlayersVec4b.length; ++i)
{
short short1 = (short)buf.readByte();
this.mapVisiblePlayersVec4b[i] = new Vec4b((byte)(short1 >> 4 & 15), buf.readByte(), buf.readByte(), (byte)(short1 & 15));
}
this.mapMaxX = buf.readUnsignedByte();
if (this.mapMaxX > 0)
{
this.mapMaxY = buf.readUnsignedByte();
this.mapMinX = buf.readUnsignedByte();
this.mapMinY = buf.readUnsignedByte();
this.mapDataBytes = buf.readByteArray();
}
}
示例2: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarIntFromBuffer();
this.uniqueId = buf.readUuid();
this.type = buf.readByte() & 255;
this.x = buf.readDouble();
this.y = buf.readDouble();
this.z = buf.readDouble();
this.yaw = buf.readByte();
this.pitch = buf.readByte();
this.headPitch = buf.readByte();
this.velocityX = buf.readShort();
this.velocityY = buf.readShort();
this.velocityZ = buf.readShort();
this.dataManagerEntries = EntityDataManager.readEntries(buf);
}
示例3: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
int i = buf.readVarIntFromBuffer();
this.field_148976_a = Maps.<StatBase, Integer>newHashMap();
for (int j = 0; j < i; ++j)
{
StatBase statbase = StatList.getOneShotStat(buf.readStringFromBuffer(32767));
int k = buf.readVarIntFromBuffer();
if (statbase != null)
{
this.field_148976_a.put(statbase, Integer.valueOf(k));
}
}
}
示例4: decode
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
protected void decode(ChannelHandlerContext p_decode_1_, ByteBuf p_decode_2_, List<Object> p_decode_3_) throws IOException, InstantiationException, IllegalAccessException, Exception
{
if (p_decode_2_.readableBytes() != 0)
{
PacketBuffer packetbuffer = new PacketBuffer(p_decode_2_);
int i = packetbuffer.readVarIntFromBuffer();
Packet packet = ((EnumConnectionState)p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get()).getPacket(this.direction, i);
if (packet == null)
{
throw new IOException("Bad packet id " + i);
}
else
{
packet.readPacketData(packetbuffer);
if (packetbuffer.readableBytes() > 0)
{
throw new IOException("Packet " + ((EnumConnectionState)p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get()).getId() + "/" + i + " (" + packet.getClass().getSimpleName() + ") was larger than I expected, found " + packetbuffer.readableBytes() + " bytes extra whilst reading packet " + i);
}
else
{
p_decode_3_.add(packet);
if (logger.isDebugEnabled())
{
logger.debug(RECEIVED_PACKET_MARKER, " IN: [{}:{}] {}", new Object[] {p_decode_1_.channel().attr(NetworkManager.attrKeyConnectionState).get(), Integer.valueOf(i), packet.getClass().getName()});
}
}
}
}
}
示例5: read
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@SideOnly(Side.CLIENT)
public void read(PacketBuffer buf)
{
this.statePaletteMap.clear();
int i = buf.readVarIntFromBuffer();
for (int j = 0; j < i; ++j)
{
this.statePaletteMap.add(Block.BLOCK_STATE_IDS.getByValue(buf.readVarIntFromBuffer()));
}
}
示例6: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.particleType = EnumParticleTypes.getParticleFromId(buf.readInt());
if (this.particleType == null)
{
this.particleType = EnumParticleTypes.BARRIER;
}
this.longDistance = buf.readBoolean();
this.xCoord = buf.readFloat();
this.yCoord = buf.readFloat();
this.zCoord = buf.readFloat();
this.xOffset = buf.readFloat();
this.yOffset = buf.readFloat();
this.zOffset = buf.readFloat();
this.particleSpeed = buf.readFloat();
this.particleCount = buf.readInt();
int i = this.particleType.getArgumentCount();
this.particleArguments = new int[i];
for (int j = 0; j < i; ++j)
{
this.particleArguments[j] = buf.readVarIntFromBuffer();
}
}
示例7: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.field_149401_a = buf.readFloat();
this.level = buf.readVarIntFromBuffer();
this.totalExperience = buf.readVarIntFromBuffer();
}
示例8: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityID = buf.readVarIntFromBuffer();
this.posX = buf.readDouble();
this.posY = buf.readDouble();
this.posZ = buf.readDouble();
this.xpValue = buf.readShort();
}
示例9: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.name = buf.readStringFromBuffer(40);
this.action = (S3CPacketUpdateScore.Action)buf.readEnumValue(S3CPacketUpdateScore.Action.class);
this.objective = buf.readStringFromBuffer(16);
if (this.action != S3CPacketUpdateScore.Action.REMOVE)
{
this.value = buf.readVarIntFromBuffer();
}
}
示例10: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.matches = new String[buf.readVarIntFromBuffer()];
for (int i = 0; i < this.matches.length; ++i)
{
this.matches[i] = buf.readStringFromBuffer(32767);
}
}
示例11: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarIntFromBuffer();
this.effectId = buf.readByte();
this.amplifier = buf.readByte();
this.duration = buf.readVarIntFromBuffer();
this.hideParticles = buf.readByte();
}
示例12: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void readPacketData(PacketBuffer buf) throws IOException
{
buf.readByte();
buf.readVarIntFromBuffer();
buf.readBoolean();
}
示例13: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarIntFromBuffer();
this.posX = buf.readInt();
this.posY = buf.readInt();
this.posZ = buf.readInt();
this.yaw = buf.readByte();
this.pitch = buf.readByte();
this.onGround = buf.readBoolean();
}
示例14: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.chunkPosCoord = new ChunkCoordIntPair(buf.readInt(), buf.readInt());
this.changedBlocks = new S22PacketMultiBlockChange.BlockUpdateData[buf.readVarIntFromBuffer()];
for (int i = 0; i < this.changedBlocks.length; ++i)
{
this.changedBlocks[i] = new S22PacketMultiBlockChange.BlockUpdateData(buf.readShort(), (IBlockState)Block.BLOCK_STATE_IDS.getByValue(buf.readVarIntFromBuffer()));
}
}
示例15: readPacketData
import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
* Reads the raw packet data from the data stream.
*/
public void readPacketData(PacketBuffer buf) throws IOException
{
this.entityId = buf.readVarIntFromBuffer();
this.effectId = buf.readUnsignedByte();
}