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


Java PacketBuffer.writeInt方法代码示例

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


在下文中一共展示了PacketBuffer.writeInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeInt(this.particleType.getParticleID());
    buf.writeBoolean(this.longDistance);
    buf.writeFloat(this.xCoord);
    buf.writeFloat(this.yCoord);
    buf.writeFloat(this.zCoord);
    buf.writeFloat(this.xOffset);
    buf.writeFloat(this.yOffset);
    buf.writeFloat(this.zOffset);
    buf.writeFloat(this.particleSpeed);
    buf.writeInt(this.particleCount);
    int i = this.particleType.getArgumentCount();

    for (int j = 0; j < i; ++j)
    {
        buf.writeVarIntToBuffer(this.particleArguments[j]);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:23,代码来源:SPacketParticles.java

示例2: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeVarIntToBuffer(this.entityId);
    buf.writeByte(this.type & 255);
    buf.writeInt(this.x);
    buf.writeInt(this.y);
    buf.writeInt(this.z);
    buf.writeByte(this.yaw);
    buf.writeByte(this.pitch);
    buf.writeByte(this.headPitch);
    buf.writeShort(this.velocityX);
    buf.writeShort(this.velocityY);
    buf.writeShort(this.velocityZ);
    this.field_149043_l.writeTo(buf);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:19,代码来源:S0FPacketSpawnMob.java

示例3: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeFloat((float)this.posX);
    buf.writeFloat((float)this.posY);
    buf.writeFloat((float)this.posZ);
    buf.writeFloat(this.strength);
    buf.writeInt(this.affectedBlockPositions.size());
    int i = (int)this.posX;
    int j = (int)this.posY;
    int k = (int)this.posZ;

    for (BlockPos blockpos : this.affectedBlockPositions)
    {
        int l = blockpos.getX() - i;
        int i1 = blockpos.getY() - j;
        int j1 = blockpos.getZ() - k;
        buf.writeByte(l);
        buf.writeByte(i1);
        buf.writeByte(j1);
    }

    buf.writeFloat(this.motionX);
    buf.writeFloat(this.motionY);
    buf.writeFloat(this.motionZ);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:29,代码来源:SPacketExplosion.java

示例4: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeEnumValue(this.eventType);

    if (this.eventType == SPacketCombatEvent.Event.END_COMBAT)
    {
        buf.writeVarIntToBuffer(this.duration);
        buf.writeInt(this.entityId);
    }
    else if (this.eventType == SPacketCombatEvent.Event.ENTITY_DIED)
    {
        buf.writeVarIntToBuffer(this.playerId);
        buf.writeInt(this.entityId);
        buf.writeTextComponent(this.deathMessage);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:SPacketCombatEvent.java

示例5: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeInt(this.entityId);
    buf.writeInt(this.vehicleEntityId);
    buf.writeByte(this.leash);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:S1BPacketEntityAttach.java

示例6: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeByte(this.windowId);
    buf.writeString(this.inventoryType);
    buf.writeTextComponent(this.windowTitle);
    buf.writeByte(this.slotCount);

    if (this.inventoryType.equals("EntityHorse"))
    {
        buf.writeInt(this.entityId);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:SPacketOpenWindow.java

示例7: actionPerformed

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    boolean flag = false;

    if (button == this.nextButton)
    {
        ++this.selectedMerchantRecipe;
        MerchantRecipeList merchantrecipelist = this.merchant.getRecipes(this.mc.thePlayer);

        if (merchantrecipelist != null && this.selectedMerchantRecipe >= merchantrecipelist.size())
        {
            this.selectedMerchantRecipe = merchantrecipelist.size() - 1;
        }

        flag = true;
    }
    else if (button == this.previousButton)
    {
        --this.selectedMerchantRecipe;

        if (this.selectedMerchantRecipe < 0)
        {
            this.selectedMerchantRecipe = 0;
        }

        flag = true;
    }

    if (flag)
    {
        ((ContainerMerchant)this.inventorySlots).setCurrentRecipeIndex(this.selectedMerchantRecipe);
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.selectedMerchantRecipe);
        this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload("MC|TrSel", packetbuffer));
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:40,代码来源:GuiMerchant.java

示例8: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeVarIntToBuffer(this.entityId);
    buf.writeByte(this.type);
    buf.writeInt(this.x);
    buf.writeInt(this.y);
    buf.writeInt(this.z);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:12,代码来源:S2CPacketSpawnGlobalEntity.java

示例9: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeInt(this.chunkPos.chunkXPos);
    buf.writeInt(this.chunkPos.chunkZPos);
    buf.writeVarIntToBuffer(this.changedBlocks.length);

    for (SPacketMultiBlockChange.BlockUpdateData spacketmultiblockchange$blockupdatedata : this.changedBlocks)
    {
        buf.writeShort(spacketmultiblockchange$blockupdatedata.getOffset());
        buf.writeVarIntToBuffer(Block.BLOCK_STATE_IDS.get(spacketmultiblockchange$blockupdatedata.getBlockState()));
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:SPacketMultiBlockChange.java

示例10: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeByte(this.windowId);
    buf.writeString(this.inventoryType);
    buf.writeChatComponent(this.windowTitle);
    buf.writeByte(this.slotCount);

    if (this.inventoryType.equals("EntityHorse"))
    {
        buf.writeInt(this.entityId);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:S2DPacketOpenWindow.java

示例11: sendToServer

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
private boolean sendToServer(int p_189820_1_)
{
    try
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        this.tileStructure.writeCoordinates(packetbuffer);
        packetbuffer.writeByte(p_189820_1_);
        packetbuffer.writeString(this.tileStructure.getMode().toString());
        packetbuffer.writeString(this.nameEdit.getText());
        packetbuffer.writeInt(this.parseCoordinate(this.posXEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.posYEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.posZEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeXEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeYEdit.getText()));
        packetbuffer.writeInt(this.parseCoordinate(this.sizeZEdit.getText()));
        packetbuffer.writeString(this.tileStructure.getMirror().toString());
        packetbuffer.writeString(this.tileStructure.getRotation().toString());
        packetbuffer.writeString(this.dataEdit.getText());
        packetbuffer.writeBoolean(this.tileStructure.ignoresEntities());
        packetbuffer.writeBoolean(this.tileStructure.showsAir());
        packetbuffer.writeBoolean(this.tileStructure.showsBoundingBox());
        packetbuffer.writeFloat(this.parseIntegrity(this.integrityEdit.getText()));
        packetbuffer.writeVarLong(this.parseSeed(this.seedEdit.getText()));
        this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|Struct", packetbuffer));
        return true;
    }
    catch (Exception exception)
    {
        LOGGER.warn((String)"Could not send structure block info", (Throwable)exception);
        return false;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:33,代码来源:GuiEditStructure.java

示例12: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeVarIntToBuffer(this.entityID);
    buf.writeInt(this.posX);
    buf.writeInt(this.posY);
    buf.writeInt(this.posZ);
    buf.writeShort(this.xpValue);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:12,代码来源:S11PacketSpawnExperienceOrb.java

示例13: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeString(this.soundName);
    buf.writeInt(this.posX);
    buf.writeInt(this.posY);
    buf.writeInt(this.posZ);
    buf.writeFloat(this.soundVolume);
    buf.writeByte(this.soundPitch);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:13,代码来源:S29PacketSoundEffect.java

示例14: actionPerformed

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Called by the controls from the buttonList when activated. (Mouse pressed for buttons)
 */
protected void actionPerformed(GuiButton button) throws IOException
{
    if (button.id == -2)
    {
        this.mc.displayGuiScreen((GuiScreen)null);
    }
    else if (button.id == -1)
    {
        String s = "MC|Beacon";
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeInt(this.tileBeacon.getField(1));
        packetbuffer.writeInt(this.tileBeacon.getField(2));
        this.mc.getNetHandler().addToSendQueue(new C17PacketCustomPayload(s, packetbuffer));
        this.mc.displayGuiScreen((GuiScreen)null);
    }
    else if (button instanceof GuiBeacon.PowerButton)
    {
        if (((GuiBeacon.PowerButton)button).func_146141_c())
        {
            return;
        }

        int j = button.id;
        int k = j & 255;
        int i = j >> 8;

        if (i < 3)
        {
            this.tileBeacon.setField(1, k);
        }
        else
        {
            this.tileBeacon.setField(2, k);
        }

        this.buttonList.clear();
        this.initGui();
        this.updateScreen();
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:44,代码来源:GuiBeacon.java

示例15: writePacketData

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes the raw packet data to the data stream.
 */
public void writePacketData(PacketBuffer buf) throws IOException
{
    buf.writeInt(this.entityId);
    buf.writeByte(this.logicOpcode);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:S19PacketEntityStatus.java


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