Java Code Examples for net.minecraft.network.PacketBuffer#writeDouble()

The following examples show how to use net.minecraft.network.PacketBuffer#writeDouble() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhysicsObject.java    From Valkyrien-Skies with Apache License 2.0 6 votes vote down vote up
public void writeSpawnData(ByteBuf buffer) {
    PacketBuffer modifiedBuffer = new PacketBuffer(buffer);

    modifiedBuffer.writeInt(getOwnedChunks().getCenterX());
    modifiedBuffer.writeInt(getOwnedChunks().getCenterZ());
    modifiedBuffer.writeInt(getOwnedChunks().getRadius());

    modifiedBuffer.writeDouble(getWrapperEntity().posX);
    modifiedBuffer.writeDouble(getWrapperEntity().posY);
    modifiedBuffer.writeDouble(getWrapperEntity().posZ);

    modifiedBuffer.writeDouble(getWrapperEntity().getPitch());
    modifiedBuffer.writeDouble(getWrapperEntity().getYaw());
    modifiedBuffer.writeDouble(getWrapperEntity().getRoll());

    getCenterCoord().writeToByteBuf(modifiedBuffer);

    // Make a local copy to avoid potential data races
    BlockPos physicsInfuserPosLocal = getPhysicsInfuserPos();
    modifiedBuffer.writeBoolean(physicsInfuserPosLocal != null);
    if (physicsInfuserPosLocal != null) {
        modifiedBuffer.writeBlockPos(physicsInfuserPosLocal);
    }
}
 
Example 2
Source File: PlayerParticleData.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
public void write(PacketBuffer buf) {
    buf.writeString(partType);
    buf.writeDouble(targetX);
    buf.writeDouble(targetY);
    buf.writeDouble(targetZ);
    buf.writeFloat(size);
    buf.writeFloat(r);
    buf.writeFloat(g);
    buf.writeFloat(b);
    buf.writeFloat(maxAgeMul);
    buf.writeBoolean(depthTest);
}
 
Example 3
Source File: EntityMountable.java    From Valkyrien-Skies with Apache License 2.0 5 votes vote down vote up
@Override
public void writeSpawnData(ByteBuf buffer) {
    PacketBuffer packetBuffer = new PacketBuffer(buffer);
    Vec3d mountPosLocal = mountPos;
    packetBuffer.writeDouble(mountPosLocal.x);
    packetBuffer.writeDouble(mountPosLocal.y);
    packetBuffer.writeDouble(mountPosLocal.z);
    packetBuffer.writeInt(mountPosSpace.ordinal());
    packetBuffer.writeBoolean(referencePos != null);
    if (referencePos != null) {
        packetBuffer.writeBlockPos(referencePos);
    }
}
 
Example 4
Source File: ChoppingRecipe.java    From Survivalist with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void write(PacketBuffer buffer, ChoppingRecipe recipe)
{
    buffer.writeString(recipe.group);
    recipe.input.write(buffer);
    buffer.writeItemStack(recipe.output);
    buffer.writeDouble(recipe.outputMultiplier);
    buffer.writeDouble(recipe.hitCountMultiplier);
    buffer.writeVarInt(recipe.maxOutput);
    buffer.writeVarInt(recipe.sawingTime);
}
 
Example 5
Source File: TileEntityAntibuilder.java    From Artifacts with MIT License 5 votes vote down vote up
protected void drawParticleLine(double srcX, double srcY, double srcZ, double destX, double destY, double destZ)
 {
 	if(this.worldObj.isRemote) {
 		return;
 	}
 	
 	int particles = 16;
 	int r = worldObj.rand.nextInt(8);
 	for (int i = 0; i < particles; i++)
 	{
 		double trailFactor = i / (particles - 1.0D);

 		double tx = srcX + (destX - srcX) * trailFactor + rand.nextFloat() * 0.005D;
 		double ty = srcY + (destY - srcY) * trailFactor + rand.nextFloat() * 0.005D;
 		double tz = srcZ + (destZ - srcZ) * trailFactor + rand.nextFloat() * 0.005D;
try
{
	PacketBuffer out = new PacketBuffer(Unpooled.buffer());
	out.writeInt(PacketHandlerClient.ANTI_BUILDER);
	out.writeDouble(tx);
	out.writeDouble(ty);
	out.writeDouble(tz);
	out.writeInt(i-r);
	SToCMessage packet = new SToCMessage(out);
	DragonArtifacts.artifactNetworkWrapper.sendToAllAround(packet, new TargetPoint(worldObj.provider.dimensionId, xCoord, yCoord, zCoord, 32));
}
catch (Exception ex)
{
	ex.printStackTrace();
	System.out.println("couldnt send packet!");
}
 		//worldObj.spawnParticle("reddust", tx, ty, tz, 0.0D, 0.0D, 0.0D);
 		//Minecraft.getMinecraft().effectRenderer.addEffect(new RadarParticle(worldObj, tx, ty, tz, 3, 20));
 	}
 }
 
Example 6
Source File: TypeRW.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void writeToStream(Double o, PacketBuffer output) {
	output.writeDouble(o);
}
 
Example 7
Source File: SyncableDouble.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void writeToStream(PacketBuffer stream) {
	stream.writeDouble(value);
}