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

The following examples show how to use net.minecraft.network.PacketBuffer#writeFloat() . 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: PacketAsteroidInfo.java    From AdvancedRocketry with MIT License 6 votes vote down vote up
@Override
public void write(ByteBuf out) {
	PacketBuffer packetBuffer = new PacketBuffer(out);
	NBTTagCompound nbt = new NBTTagCompound();
	
	packetBuffer.writeString(asteroid.ID);
	packetBuffer.writeInt(asteroid.distance);
	packetBuffer.writeInt(asteroid.mass);
	packetBuffer.writeInt(asteroid.minLevel);
	packetBuffer.writeFloat(asteroid.massVariability);
	packetBuffer.writeFloat(asteroid.richness);					//factor of the ratio of ore to stone
	packetBuffer.writeFloat(asteroid.richnessVariability);		//variability of richness
	packetBuffer.writeFloat(asteroid.probability);				//probability of the asteroid spawning
	packetBuffer.writeFloat(asteroid.timeMultiplier);
	
	packetBuffer.writeInt(asteroid.stackProbabilites.size());
	for(int i = 0; i < asteroid.stackProbabilites.size(); i++)
	{
		packetBuffer.writeItemStack(asteroid.itemStacks.get(i));
		packetBuffer.writeFloat(asteroid.stackProbabilites.get(i));
	}
}
 
Example 2
Source File: LaserParticleData.java    From MiningGadgets with MIT License 5 votes vote down vote up
@Override
public void write(PacketBuffer buf) {
    buf.writeVarInt(Block.BLOCK_STATE_IDS.get(state));
    buf.writeFloat(size);
    buf.writeFloat(r);
    buf.writeFloat(g);
    buf.writeFloat(b);
    buf.writeFloat(maxAgeMul);
    buf.writeBoolean(depthTest);
}
 
Example 3
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 4
Source File: MetaTileEntityLockedSafe.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void writeInitialSyncData(PacketBuffer buf) {
    super.writeInitialSyncData(buf);
    buf.writeVarInt(unlockComponentTier);
    buf.writeBoolean(isSafeUnlocked);
    buf.writeFloat(doorAngle);
    buf.writeVarLong(unlockComponentsSeed);
}
 
Example 5
Source File: ComponentHeal.java    From Artifacts with MIT License 5 votes vote down vote up
@Override
public ItemStack onItemRightClick(ItemStack itemStack, World world, EntityPlayer player) {
	PacketBuffer out = new PacketBuffer(Unpooled.buffer());
		//System.out.println("Building packet...");
	out.writeInt(PacketHandlerServer.HEALING);
	out.writeFloat(1);
	CToSMessage packet = new CToSMessage(out);
	DragonArtifacts.artifactNetworkWrapper.sendToServer(packet);
	UtilsForComponents.sendItemDamagePacket(player, player.inventory.currentItem, 1);
	itemStack.stackTagCompound.setInteger("onItemRightClickDelay", 20);

	return itemStack;
}
 
Example 6
Source File: PacketChangeVolume.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static void encode(PacketChangeVolume msg, PacketBuffer buffer) {
    buffer.writeFloat(msg.volume);
}
 
Example 7
Source File: NBTUtil.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void write(PacketBuffer buf, Vec3d value) {
    buf.writeFloat((float) value.x);
    buf.writeFloat((float) value.y);
    buf.writeFloat((float) value.z);
}
 
Example 8
Source File: TypeRW.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void writeToStream(Float o, PacketBuffer output) {
	output.writeFloat(o);
}
 
Example 9
Source File: SyncableFloat.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void writeToStream(PacketBuffer stream) {
	stream.writeFloat(value);
}