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

The following examples show how to use net.minecraft.network.PacketBuffer#readFloat() . 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 readClient(ByteBuf in) {
	PacketBuffer packetBuffer = new PacketBuffer(in);
	
	asteroid.ID = packetBuffer.readString(128);
	asteroid.distance = packetBuffer.readInt();
	asteroid.mass = packetBuffer.readInt();
	asteroid.minLevel = packetBuffer.readInt();
	asteroid.massVariability = packetBuffer.readFloat();
	asteroid.richness = packetBuffer.readFloat();					//factor of the ratio of ore to stone
	asteroid.richnessVariability = packetBuffer.readFloat();		//variability of richness
	asteroid.probability = packetBuffer.readFloat();				//probability of the asteroid spawning
	asteroid.timeMultiplier = packetBuffer.readFloat();
	
	int size = packetBuffer.readInt();
	for(int i = 0; i < size; i++)
	{
		try {
			asteroid.itemStacks.add(packetBuffer.readItemStack());
			asteroid.stackProbabilites.add(packetBuffer.readFloat());
		} catch (IOException e) {
			e.printStackTrace();
		}
	}
}
 
Example 2
Source File: SliderWidget.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void handleClientAction(int id, PacketBuffer buffer) {
    if (id == 1) {
        this.sliderPosition = buffer.readFloat();
        this.sliderPosition = MathHelper.clamp(sliderPosition, 0.0f, 1.0f);
        this.responder.apply(getSliderValue());
    }
}
 
Example 3
Source File: SliderWidget.java    From GregTech with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void readUpdateInfo(int id, PacketBuffer buffer) {
    if (id == 1) {
        this.sliderPosition = buffer.readFloat();
        this.sliderPosition = MathHelper.clamp(sliderPosition, 0.0f, 1.0f);
        this.displayString = getDisplayString();
    }
}
 
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 receiveInitialSyncData(PacketBuffer buf) {
    super.receiveInitialSyncData(buf);
    this.unlockComponentTier = buf.readVarInt();
    this.isSafeUnlocked = buf.readBoolean();
    this.doorAngle = buf.readFloat();
    this.prevDoorAngle = doorAngle;
    this.unlockComponentsSeed = buf.readVarLong();
}
 
Example 5
Source File: LaserParticleData.java    From MiningGadgets with MIT License 4 votes vote down vote up
@Override
public LaserParticleData read(@Nonnull ParticleType<LaserParticleData> type, PacketBuffer buf) {
    return new LaserParticleData(Block.BLOCK_STATE_IDS.getByValue(buf.readVarInt()), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readBoolean());
}
 
Example 6
Source File: PlayerParticleData.java    From MiningGadgets with MIT License 4 votes vote down vote up
@Override
public PlayerParticleData read(@Nonnull ParticleType<PlayerParticleData> type, PacketBuffer buf) {
    return new PlayerParticleData(buf.readString(), buf.readDouble(), buf.readDouble(), buf.readDouble(), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readFloat(), buf.readBoolean());
}
 
Example 7
Source File: PacketChangeVolume.java    From MiningGadgets with MIT License 4 votes vote down vote up
public static PacketChangeVolume decode(PacketBuffer buffer) {
    return new PacketChangeVolume(buffer.readFloat());
}
 
Example 8
Source File: NBTUtil.java    From GregTech with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public Vec3d read(PacketBuffer buf) {
    return new Vec3d(buf.readFloat(), buf.readFloat(), buf.readFloat());
}
 
Example 9
Source File: TypeRW.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public Float readFromStream(PacketBuffer input) {
	return input.readFloat();
}
 
Example 10
Source File: SyncableFloat.java    From OpenModsLib with MIT License 4 votes vote down vote up
@Override
public void readFromStream(PacketBuffer stream) {
	value = stream.readFloat();
}