NoiseConfig.java
package com.hypixel.hytale.protocol;
import com.hypixel.hytale.protocol.io.ValidationResult;
import io.netty.buffer.ByteBuf;
import java.util.Objects;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
public class NoiseConfig {
public static final int NULLABLE_BIT_FIELD_SIZE = 1;
public static final int FIXED_BLOCK_SIZE = 23;
public static final int VARIABLE_FIELD_COUNT = 0;
public static final int VARIABLE_BLOCK_START = 23;
public static final int MAX_SIZE = 23;
public seed;
NoiseType type;
frequency;
amplitude;
ClampConfig clamp;
{
.type = NoiseType.Sin;
}
{
.type = NoiseType.Sin;
.seed = seed;
.type = type;
.frequency = frequency;
.amplitude = amplitude;
.clamp = clamp;
}
{
.type = NoiseType.Sin;
.seed = other.seed;
.type = other.type;
.frequency = other.frequency;
.amplitude = other.amplitude;
.clamp = other.clamp;
}
NoiseConfig {
();
buf.getByte(offset);
obj.seed = buf.getIntLE(offset + );
obj.type = NoiseType.fromValue(buf.getByte(offset + ));
obj.frequency = buf.getFloatLE(offset + );
obj.amplitude = buf.getFloatLE(offset + );
((nullBits & ) != ) {
obj.clamp = ClampConfig.deserialize(buf, offset + );
}
obj;
}
{
;
}
{
;
(.clamp != ) {
nullBits = ()(nullBits | );
}
buf.writeByte(nullBits);
buf.writeIntLE(.seed);
buf.writeByte(.type.getValue());
buf.writeFloatLE(.frequency);
buf.writeFloatLE(.amplitude);
(.clamp != ) {
.clamp.serialize(buf);
} {
buf.writeZero();
}
}
{
;
}
ValidationResult {
buffer.readableBytes() - offset < ? ValidationResult.error() : ValidationResult.OK;
}
NoiseConfig {
();
copy.seed = .seed;
copy.type = .type;
copy.frequency = .frequency;
copy.amplitude = .amplitude;
copy.clamp = .clamp != ? .clamp.clone() : ;
copy;
}
{
( == obj) {
;
} (!(obj NoiseConfig)) {
;
} {
(NoiseConfig)obj;
.seed == other.seed && Objects.equals(.type, other.type) && .frequency == other.frequency && .amplitude == other.amplitude && Objects.equals(.clamp, other.clamp);
}
}
{
Objects.hash( []{.seed, .type, .frequency, .amplitude, .clamp});
}
}