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


Java PacketBuffer.writeEnumValue方法代码示例

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


在下文中一共展示了PacketBuffer.writeEnumValue方法的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.writeEnumValue(this.type);

    if (this.type == SPacketTitle.Type.TITLE || this.type == SPacketTitle.Type.SUBTITLE || this.type == SPacketTitle.Type.ACTIONBAR)
    {
        buf.writeTextComponent(this.message);
    }

    if (this.type == SPacketTitle.Type.TIMES)
    {
        buf.writeInt(this.fadeInTime);
        buf.writeInt(this.displayTime);
        buf.writeInt(this.fadeOutTime);
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:SPacketTitle.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.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

示例3: openBook

import net.minecraft.network.PacketBuffer; //导入方法依赖的package包/类
public void openBook(ItemStack stack, EnumHand hand)
{
    Item item = stack.getItem();

    if (item == Items.WRITTEN_BOOK)
    {
        PacketBuffer packetbuffer = new PacketBuffer(Unpooled.buffer());
        packetbuffer.writeEnumValue(hand);
        this.connection.sendPacket(new SPacketCustomPayload("MC|BOpen", packetbuffer));
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:EntityPlayerMP.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.entityId);
    buf.writeEnumValue(this.action);

    if (this.action == C02PacketUseEntity.Action.INTERACT_AT)
    {
        buf.writeFloat((float)this.hitVec.xCoord);
        buf.writeFloat((float)this.hitVec.yCoord);
        buf.writeFloat((float)this.hitVec.zCoord);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:16,代码来源:C02PacketUseEntity.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.writeBlockPos(this.position);
    buf.writeEnumValue(this.placedBlockDirection);
    buf.writeEnumValue(this.hand);
    buf.writeFloat(this.facingX);
    buf.writeFloat(this.facingY);
    buf.writeFloat(this.facingZ);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:CPacketPlayerTryUseItemOnBlock.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.writeUuid(this.uniqueId);
    buf.writeEnumValue(this.operation);

    switch (this.operation)
    {
        case ADD:
            buf.writeTextComponent(this.name);
            buf.writeFloat(this.percent);
            buf.writeEnumValue(this.color);
            buf.writeEnumValue(this.overlay);
            buf.writeByte(this.getFlags());
        case REMOVE:
        default:
            break;
        case UPDATE_PCT:
            buf.writeFloat(this.percent);
            break;
        case UPDATE_NAME:
            buf.writeTextComponent(this.name);
            break;
        case UPDATE_STYLE:
            buf.writeEnumValue(this.color);
            buf.writeEnumValue(this.overlay);
            break;
        case UPDATE_PROPERTIES:
            buf.writeByte(this.getFlags());
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:34,代码来源:SPacketUpdateBossInfo.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.writeEnumValue(this.action);
    buf.writeBlockPos(this.position);
    buf.writeByte(this.facing.getIndex());
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:10,代码来源:CPacketPlayerDigging.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.writeEnumValue(this.status);
    buf.writeBlockPos(this.position);
    buf.writeByte(this.facing.getIndex());
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:10,代码来源:C07PacketPlayerDigging.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.writeString(this.name);
    buf.writeEnumValue(this.action);
    buf.writeString(this.objective);

    if (this.action != SPacketUpdateScore.Action.REMOVE)
    {
        buf.writeVarIntToBuffer(this.value);
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:SPacketUpdateScore.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.writeUuid(this.uniqueId);
    buf.writeEnumValue(this.operation);

    switch (this.operation)
    {
        case ADD:
            buf.writeTextComponent(this.name);
            buf.writeFloat(this.percent);
            buf.writeEnumValue(this.color);
            buf.writeEnumValue(this.overlay);
            buf.writeByte(this.getFlags());

        case REMOVE:
        default:
            break;

        case UPDATE_PCT:
            buf.writeFloat(this.percent);
            break;

        case UPDATE_NAME:
            buf.writeTextComponent(this.name);
            break;

        case UPDATE_STYLE:
            buf.writeEnumValue(this.color);
            buf.writeEnumValue(this.overlay);
            break;

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

示例11: 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.writeEnumValue(this.chatVisibility);
    buf.writeBoolean(this.enableColors);
    buf.writeByte(this.modelPartFlags);
    buf.writeEnumValue(this.mainHand);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:13,代码来源:CPacketClientSettings.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.name);
    buf.writeEnumValue(this.action);
    buf.writeString(this.objective);

    if (this.action != S3CPacketUpdateScore.Action.REMOVE)
    {
        buf.writeVarIntToBuffer(this.value);
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:15,代码来源:S3CPacketUpdateScore.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.writeEnumValue(this.action);

    switch (this.action)
    {
        case SET_SIZE:
            buf.writeDouble(this.targetSize);
            break;

        case LERP_SIZE:
            buf.writeDouble(this.diameter);
            buf.writeDouble(this.targetSize);
            buf.writeVarLong(this.timeUntilTarget);
            break;

        case SET_CENTER:
            buf.writeDouble(this.centerX);
            buf.writeDouble(this.centerZ);
            break;

        case SET_WARNING_BLOCKS:
            buf.writeVarIntToBuffer(this.warningDistance);
            break;

        case SET_WARNING_TIME:
            buf.writeVarIntToBuffer(this.warningTime);
            break;

        case INITIALIZE:
            buf.writeDouble(this.centerX);
            buf.writeDouble(this.centerZ);
            buf.writeDouble(this.diameter);
            buf.writeDouble(this.targetSize);
            buf.writeVarLong(this.timeUntilTarget);
            buf.writeVarIntToBuffer(this.size);
            buf.writeVarIntToBuffer(this.warningDistance);
            buf.writeVarIntToBuffer(this.warningTime);
    }
}
 
开发者ID:SkidJava,项目名称:BaseClient,代码行数:44,代码来源:S44PacketWorldBorder.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.writeString(this.hash);
    buf.writeEnumValue(this.status);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:9,代码来源:C19PacketResourcePackStatus.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.writeEnumValue(this.action);
    buf.writeVarIntToBuffer(this.players.size());

    for (S38PacketPlayerListItem.AddPlayerData s38packetplayerlistitem$addplayerdata : this.players)
    {
        switch (this.action)
        {
            case ADD_PLAYER:
                buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId());
                buf.writeString(s38packetplayerlistitem$addplayerdata.getProfile().getName());
                buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getProfile().getProperties().size());

                for (Property property : s38packetplayerlistitem$addplayerdata.getProfile().getProperties().values())
                {
                    buf.writeString(property.getName());
                    buf.writeString(property.getValue());

                    if (property.hasSignature())
                    {
                        buf.writeBoolean(true);
                        buf.writeString(property.getSignature());
                    }
                    else
                    {
                        buf.writeBoolean(false);
                    }
                }

                buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getGameMode().getID());
                buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getPing());

                if (s38packetplayerlistitem$addplayerdata.getDisplayName() == null)
                {
                    buf.writeBoolean(false);
                }
                else
                {
                    buf.writeBoolean(true);
                    buf.writeChatComponent(s38packetplayerlistitem$addplayerdata.getDisplayName());
                }

                break;

            case UPDATE_GAME_MODE:
                buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId());
                buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getGameMode().getID());
                break;

            case UPDATE_LATENCY:
                buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId());
                buf.writeVarIntToBuffer(s38packetplayerlistitem$addplayerdata.getPing());
                break;

            case UPDATE_DISPLAY_NAME:
                buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId());

                if (s38packetplayerlistitem$addplayerdata.getDisplayName() == null)
                {
                    buf.writeBoolean(false);
                }
                else
                {
                    buf.writeBoolean(true);
                    buf.writeChatComponent(s38packetplayerlistitem$addplayerdata.getDisplayName());
                }

                break;

            case REMOVE_PLAYER:
                buf.writeUuid(s38packetplayerlistitem$addplayerdata.getProfile().getId());
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:79,代码来源:S38PacketPlayerListItem.java


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