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