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


Java PacketBuffer.readFloat方法代码示例

本文整理汇总了Java中net.minecraft.network.PacketBuffer.readFloat方法的典型用法代码示例。如果您正苦于以下问题:Java PacketBuffer.readFloat方法的具体用法?Java PacketBuffer.readFloat怎么用?Java PacketBuffer.readFloat使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.network.PacketBuffer的用法示例。


在下文中一共展示了PacketBuffer.readFloat方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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.posX = (double)buf.readFloat();
    this.posY = (double)buf.readFloat();
    this.posZ = (double)buf.readFloat();
    this.strength = buf.readFloat();
    int i = buf.readInt();
    this.affectedBlockPositions = Lists.<BlockPos>newArrayListWithCapacity(i);
    int j = (int)this.posX;
    int k = (int)this.posY;
    int l = (int)this.posZ;

    for (int i1 = 0; i1 < i; ++i1)
    {
        int j1 = buf.readByte() + j;
        int k1 = buf.readByte() + k;
        int l1 = buf.readByte() + l;
        this.affectedBlockPositions.add(new BlockPos(j1, k1, l1));
    }

    this.motionX = buf.readFloat();
    this.motionY = buf.readFloat();
    this.motionZ = buf.readFloat();
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:28,代码来源:SPacketExplosion.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.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:SkidJava,项目名称:BaseClient,代码行数:30,代码来源:S2APacketParticles.java

示例3: readPacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.x = buf.readDouble();
    this.y = buf.readDouble();
    this.z = buf.readDouble();
    this.yaw = buf.readFloat();
    this.pitch = buf.readFloat();
    super.readPacketData(buf);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:10,代码来源:C03PacketPlayer.java

示例4: 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.action = (C02PacketUseEntity.Action)buf.readEnumValue(C02PacketUseEntity.Action.class);

    if (this.action == C02PacketUseEntity.Action.INTERACT_AT)
    {
        this.hitVec = new Vec3((double)buf.readFloat(), (double)buf.readFloat(), (double)buf.readFloat());
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:C02PacketUseEntity.java

示例5: readPacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Reads the raw packet data from the data stream.
 */
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.x = buf.readDouble();
    this.y = buf.readDouble();
    this.z = buf.readDouble();
    this.yaw = buf.readFloat();
    this.pitch = buf.readFloat();
    this.field_179835_f = S08PacketPlayerPosLook.EnumFlags.func_180053_a(buf.readUnsignedByte());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:13,代码来源:S08PacketPlayerPosLook.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.health = buf.readFloat();
    this.foodLevel = buf.readVarIntFromBuffer();
    this.saturationLevel = buf.readFloat();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:10,代码来源:S06PacketUpdateHealth.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.uniqueId = buf.readUuid();
    this.operation = (SPacketUpdateBossInfo.Operation)buf.readEnumValue(SPacketUpdateBossInfo.Operation.class);

    switch (this.operation)
    {
        case ADD:
            this.name = buf.readTextComponent();
            this.percent = buf.readFloat();
            this.color = (BossInfo.Color)buf.readEnumValue(BossInfo.Color.class);
            this.overlay = (BossInfo.Overlay)buf.readEnumValue(BossInfo.Overlay.class);
            this.setFlags(buf.readUnsignedByte());

        case REMOVE:
        default:
            break;

        case UPDATE_PCT:
            this.percent = buf.readFloat();
            break;

        case UPDATE_NAME:
            this.name = buf.readTextComponent();
            break;

        case UPDATE_STYLE:
            this.color = (BossInfo.Color)buf.readEnumValue(BossInfo.Color.class);
            this.overlay = (BossInfo.Overlay)buf.readEnumValue(BossInfo.Overlay.class);
            break;

        case UPDATE_PROPERTIES:
            this.setFlags(buf.readUnsignedByte());
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:39,代码来源:SPacketUpdateBossInfo.java

示例8: createFromBuffer

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
public static PathPoint createFromBuffer(PacketBuffer buf)
{
    PathPoint pathpoint = new PathPoint(buf.readInt(), buf.readInt(), buf.readInt());
    pathpoint.distanceFromOrigin = buf.readFloat();
    pathpoint.cost = buf.readFloat();
    pathpoint.costMalus = buf.readFloat();
    pathpoint.visited = buf.readBoolean();
    pathpoint.nodeType = PathNodeType.values()[buf.readInt()];
    pathpoint.distanceToTarget = buf.readFloat();
    return pathpoint;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:PathPoint.java

示例9: read

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
public Rotations read(PacketBuffer buf)
{
    return new Rotations(buf.readFloat(), buf.readFloat(), buf.readFloat());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:5,代码来源:DataSerializers.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.state = buf.readUnsignedByte();
    this.field_149141_c = buf.readFloat();
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:S2BPacketChangeGameState.java

示例11: readPacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
public void readPacketData(PacketBuffer buf) throws IOException
{
    this.yaw = buf.readFloat();
    this.pitch = buf.readFloat();
    super.readPacketData(buf);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:7,代码来源:C03PacketPlayer.java

示例12: handleCustomPayload

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Handles packets that have room for a channel specification. Vanilla implemented channels are "MC|TrList" to
 * acquire a MerchantRecipeList trades for a villager merchant, "MC|Brand" which sets the server brand? on the
 * player instance and finally "MC|RPack" which the server uses to communicate the identifier of the default server
 * resourcepack for the client to load.
 */
public void handleCustomPayload(SPacketCustomPayload packetIn)
{
    PacketThreadUtil.checkThreadAndEnqueue(packetIn, this, this.gameController);

    if ("MC|TrList".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer = packetIn.getBufferData();

        try
        {
            int i = packetbuffer.readInt();
            GuiScreen guiscreen = this.gameController.currentScreen;

            if (guiscreen != null && guiscreen instanceof GuiMerchant && i == this.gameController.thePlayer.openContainer.windowId)
            {
                IMerchant imerchant = ((GuiMerchant)guiscreen).getMerchant();
                MerchantRecipeList merchantrecipelist = MerchantRecipeList.readFromBuf(packetbuffer);
                imerchant.setRecipes(merchantrecipelist);
            }
        }
        catch (IOException ioexception)
        {
            LOGGER.error((String)"Couldn\'t load trade info", (Throwable)ioexception);
        }
        finally
        {
            packetbuffer.release();
        }
    }
    else if ("MC|Brand".equals(packetIn.getChannelName()))
    {
        this.gameController.thePlayer.setServerBrand(packetIn.getBufferData().readStringFromBuffer(32767));
    }
    else if ("MC|BOpen".equals(packetIn.getChannelName()))
    {
        EnumHand enumhand = (EnumHand)packetIn.getBufferData().readEnumValue(EnumHand.class);
        ItemStack itemstack = enumhand == EnumHand.OFF_HAND ? this.gameController.thePlayer.getHeldItemOffhand() : this.gameController.thePlayer.getHeldItemMainhand();

        if (itemstack != null && itemstack.getItem() == Items.WRITTEN_BOOK)
        {
            this.gameController.displayGuiScreen(new GuiScreenBook(this.gameController.thePlayer, itemstack, false));
        }
    }
    else if ("MC|DebugPath".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer1 = packetIn.getBufferData();
        int j = packetbuffer1.readInt();
        float f = packetbuffer1.readFloat();
        Path path = Path.read(packetbuffer1);
        ((DebugRendererPathfinding)this.gameController.debugRenderer.debugRendererPathfinding).addPath(j, path, f);
    }
    else if ("MC|StopSound".equals(packetIn.getChannelName()))
    {
        PacketBuffer packetbuffer2 = packetIn.getBufferData();
        String s = packetbuffer2.readStringFromBuffer(32767);
        String s1 = packetbuffer2.readStringFromBuffer(256);
        this.gameController.getSoundHandler().stop(s1, SoundCategory.getByName(s));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:66,代码来源:NetHandlerPlayClient.java

示例13: readWatchedListFromPacketBuffer

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
public static List<DataWatcher.WatchableObject> readWatchedListFromPacketBuffer(PacketBuffer buffer) throws IOException
{
    List<DataWatcher.WatchableObject> list = null;

    for (int i = buffer.readByte(); i != 127; i = buffer.readByte())
    {
        if (list == null)
        {
            list = Lists.<DataWatcher.WatchableObject>newArrayList();
        }

        int j = (i & 224) >> 5;
        int k = i & 31;
        DataWatcher.WatchableObject datawatcher$watchableobject = null;

        switch (j)
        {
            case 0:
                datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Byte.valueOf(buffer.readByte()));
                break;

            case 1:
                datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Short.valueOf(buffer.readShort()));
                break;

            case 2:
                datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Integer.valueOf(buffer.readInt()));
                break;

            case 3:
                datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, Float.valueOf(buffer.readFloat()));
                break;

            case 4:
                datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, buffer.readStringFromBuffer(32767));
                break;

            case 5:
                datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, buffer.readItemStackFromBuffer());
                break;

            case 6:
                int l = buffer.readInt();
                int i1 = buffer.readInt();
                int j1 = buffer.readInt();
                datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, new BlockPos(l, i1, j1));
                break;

            case 7:
                float f = buffer.readFloat();
                float f1 = buffer.readFloat();
                float f2 = buffer.readFloat();
                datawatcher$watchableobject = new DataWatcher.WatchableObject(j, k, new Rotations(f, f1, f2));
        }

        list.add(datawatcher$watchableobject);
    }

    return list;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:61,代码来源:DataWatcher.java


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