本文整理汇总了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);
}
示例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);
}
}
示例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());
}
示例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());
}
}
示例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());
}
示例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;
}
}
示例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);
}
示例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);
}
}
示例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());
}
示例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());
}
}
示例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();
}
}
}
示例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());
}
示例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);
}
示例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);
}
示例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);
}