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


Java PacketBuffer.readVarIntFromBuffer方法代码示例

本文整理汇总了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();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:26,代码来源:S34PacketMaps.java

示例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);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:20,代码来源:SPacketSpawnMob.java

示例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));
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:20,代码来源:S37PacketStatistics.java

示例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()});
                }
            }
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:33,代码来源:MessageDeserializer.java

示例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()));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:BlockStatePaletteHashMap.java

示例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();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:30,代码来源:SPacketParticles.java

示例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();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:S1FPacketSetExperience.java

示例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();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:SPacketSpawnExperienceOrb.java

示例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();
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:S3CPacketUpdateScore.java

示例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);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:SPacketTabComplete.java

示例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();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:12,代码来源:S1DPacketEntityEffect.java

示例12: readPacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
@Override
public void readPacketData(PacketBuffer buf) throws IOException
{
	buf.readByte();
	buf.readVarIntFromBuffer();
	buf.readBoolean();
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:8,代码来源:CPacketSomethingNew.java

示例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();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:S18PacketEntityTeleport.java

示例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()));
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:14,代码来源:S22PacketMultiBlockChange.java

示例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();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:S1EPacketRemoveEntityEffect.java


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