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


Java PacketBuffer.writeString方法代码示例

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


在下文中一共展示了PacketBuffer.writeString方法的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.entityId);
    int i = this.gameType.getID();

    if (this.hardcoreMode)
    {
        i |= 8;
    }

    buf.writeByte(i);
    buf.writeByte(this.dimension);
    buf.writeByte(this.difficulty.getDifficultyId());
    buf.writeByte(this.maxPlayers);
    buf.writeString(this.worldType.getWorldTypeName());
    buf.writeBoolean(this.reducedDebugInfo);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:21,代码来源:S01PacketJoinGame.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.writeString(StringUtils.substring(this.message, 0, 32767));
    buf.writeBoolean(this.hasTargetBlock);
    boolean flag = this.targetBlock != null;
    buf.writeBoolean(flag);

    if (flag)
    {
        buf.writeBlockPos(this.targetBlock);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:16,代码来源:CPacketTabComplete.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.writeVarIntToBuffer(this.entityID);
    buf.writeString(this.title);
    buf.writeBlockPos(this.position);
    buf.writeByte(this.facing.getHorizontalIndex());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:11,代码来源:S10PacketSpawnPainting.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.writeVarIntToBuffer(this.field_148976_a.size());

    for (Entry<StatBase, Integer> entry : this.field_148976_a.entrySet())
    {
        buf.writeString(((StatBase)entry.getKey()).statId);
        buf.writeVarIntToBuffer(((Integer)entry.getValue()).intValue());
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:14,代码来源:S37PacketStatistics.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.dimensionID);
    buf.writeByte(this.difficulty.getDifficultyId());
    buf.writeByte(this.gameType.getID());
    buf.writeString(this.worldType.getWorldTypeName());
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:11,代码来源:SPacketRespawn.java

示例6: 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

示例7: 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.lang);
    buf.writeByte(this.view);
    buf.writeByte(this.chatVisibility.getChatVisibility());
    buf.writeBoolean(this.enableColors);
    buf.writeByte(this.modelPartFlags);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:12,代码来源:C15PacketClientSettings.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.writeString(StringUtils.substring(this.message, 0, 32767));
    boolean flag = this.targetBlock != null;
    buf.writeBoolean(flag);

    if (flag)
    {
        buf.writeBlockPos(this.targetBlock);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:C14PacketTabComplete.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.writeVarIntToBuffer(this.protocolVersion);
    buf.writeString(this.ip);
    buf.writeShort(this.port);
    buf.writeVarIntToBuffer(this.requestedState.getId());
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:11,代码来源:C00Handshake.java

示例10: writeWatchableObjectToPacketBuffer

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
/**
 * Writes a watchable object (entity attribute of type {byte, short, int, float, string, ItemStack,
 * ChunkCoordinates}) to the specified PacketBuffer
 */
private static void writeWatchableObjectToPacketBuffer(PacketBuffer buffer, DataWatcher.WatchableObject object) throws IOException
{
    int i = (object.getObjectType() << 5 | object.getDataValueId() & 31) & 255;
    buffer.writeByte(i);

    switch (object.getObjectType())
    {
        case 0:
            buffer.writeByte(((Byte)object.getObject()).byteValue());
            break;

        case 1:
            buffer.writeShort(((Short)object.getObject()).shortValue());
            break;

        case 2:
            buffer.writeInt(((Integer)object.getObject()).intValue());
            break;

        case 3:
            buffer.writeFloat(((Float)object.getObject()).floatValue());
            break;

        case 4:
            buffer.writeString((String)object.getObject());
            break;

        case 5:
            ItemStack itemstack = (ItemStack)object.getObject();
            buffer.writeItemStackToBuffer(itemstack);
            break;

        case 6:
            BlockPos blockpos = (BlockPos)object.getObject();
            buffer.writeInt(blockpos.getX());
            buffer.writeInt(blockpos.getY());
            buffer.writeInt(blockpos.getZ());
            break;

        case 7:
            Rotations rotations = (Rotations)object.getObject();
            buffer.writeFloat(rotations.getX());
            buffer.writeFloat(rotations.getY());
            buffer.writeFloat(rotations.getZ());
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:51,代码来源:DataWatcher.java

示例11: 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.enabled)
    {
        CommandBlockBaseLogic commandblockbaselogic = this.commandBlock.getCommandBlockLogic();

        if (button.id == 1)
        {
            commandblockbaselogic.setTrackOutput(this.trackOutput);
            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 0)
        {
            PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
            commandblockbaselogic.fillInInfo(packetbuffer);
            packetbuffer.writeString(this.commandTextField.getText());
            packetbuffer.writeBoolean(commandblockbaselogic.shouldTrackOutput());
            packetbuffer.writeString(this.commandBlockMode.name());
            packetbuffer.writeBoolean(this.conditional);
            packetbuffer.writeBoolean(this.automatic);
            this.mc.getConnection().sendPacket(new CPacketCustomPayload("MC|AutoCmd", packetbuffer));

            if (!commandblockbaselogic.shouldTrackOutput())
            {
                commandblockbaselogic.setLastOutput((ITextComponent)null);
            }

            this.mc.displayGuiScreen((GuiScreen)null);
        }
        else if (button.id == 4)
        {
            commandblockbaselogic.setTrackOutput(!commandblockbaselogic.shouldTrackOutput());
            this.updateCmdOutput();
        }
        else if (button.id == 5)
        {
            this.nextMode();
            this.updateMode();
        }
        else if (button.id == 6)
        {
            this.conditional = !this.conditional;
            this.updateConditional();
        }
        else if (button.id == 7)
        {
            this.automatic = !this.automatic;
            this.updateAutoExec();
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:55,代码来源:GuiCommandBlock.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.writeString(this.profile.getName());
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:C00PacketLoginStart.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.hash);
    buf.writeEnumValue(this.status);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:C19PacketResourcePackStatus.java

示例14: 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.position);
    buf.writeString(this.scoreName);
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:9,代码来源:S3DPacketDisplayScoreboard.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.writeString(this.message);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:8,代码来源:C01PacketChatMessage.java


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