77import net .minecraft .nbt .CompoundTag ;
88import net .minecraft .network .FriendlyByteBuf ;
99import net .minecraft .network .codec .StreamCodec ;
10- import org .jetbrains .annotations .NotNull ;
1110import org .jetbrains .annotations .Nullable ;
1211
1312import java .util .Objects ;
@@ -16,11 +15,11 @@ public class SpecificRealGasState {
1615
1716 public static final SpecificRealGasState DEFAULT_STATE = new SpecificRealGasState (101_300f , 112_665f , null , null , null );
1817 public static final StreamCodec <ByteBuf , SpecificRealGasState > STREAM_CODEC = new StreamCodec <>() {
19- public @ NotNull SpecificRealGasState decode (@ NotNull ByteBuf buffer ) {
18+ public SpecificRealGasState decode (ByteBuf buffer ) {
2019 return new SpecificRealGasState (Objects .requireNonNull (FriendlyByteBuf .readNbt (buffer )));
2120 }
2221
23- public void encode (@ NotNull ByteBuf buffer , SpecificRealGasState state ) {
22+ public void encode (ByteBuf buffer , SpecificRealGasState state ) {
2423 FriendlyByteBuf .writeNbt (buffer , state .serialize ());
2524 }
2625 };
@@ -33,19 +32,19 @@ public void encode(@NotNull ByteBuf buffer, SpecificRealGasState state) {
3332 Codec .FLOAT .optionalFieldOf ("vapor_quality" , null ).forGetter (p -> p .vaporQuality )
3433 )
3534 .apply (i , SpecificRealGasState ::new ));
36- Float pressure ;
37- Float specificEnthalpy ;
38- Float temperature ;
39- Float specificEntropy ;
40- Float vaporQuality ;
35+ final Float pressure ;
36+ final Float specificEnthalpy ;
37+ @ Nullable Float temperature ;
38+ @ Nullable Float specificEntropy ;
39+ @ Nullable Float vaporQuality ;
4140
4241 public SpecificRealGasState (CompoundTag tag ) {
4342 this (tag .getFloat ("pressure" ), tag .getFloat ("specific_enthalpy" ), tag .contains ("temperature" ) ? tag .getFloat ("temperature" ) : null ,
4443 tag .contains ("specific_entropy" ) ? tag .getFloat ("specific_entropy" ) : null ,
4544 tag .contains ("vapor_quality" ) ? tag .getFloat ("vapor_quality" ) : null );
4645 }
4746
48- public SpecificRealGasState (@ NotNull Float pressure , @ NotNull Float specificEnthalpy , @ Nullable Float temperature ,
47+ public SpecificRealGasState (Float pressure , Float specificEnthalpy , @ Nullable Float temperature ,
4948 @ Nullable Float specificEntropy , @ Nullable Float vaporQuality ) {
5049 this .temperature = temperature == null ? null : Math .max (0 , temperature );
5150 this .pressure = Math .max (0 , pressure );
@@ -58,7 +57,7 @@ public SpecificRealGasState(@NotNull Float pressure, @NotNull Float specificEnth
5857 }
5958
6059 @ Override
61- public @ NotNull String toString () {
60+ public String toString () {
6261 return "SpecificRealGasState{" +
6362 "temperature=" + temperature +
6463 ", pressure=" + pressure +
@@ -70,29 +69,29 @@ public SpecificRealGasState(@NotNull Float pressure, @NotNull Float specificEnth
7069
7170 public CompoundTag serialize () {
7271 CompoundTag tag = new CompoundTag ();
72+ tag .putFloat ("pressure" , pressure );
73+ tag .putFloat ("specific_enthalpy" , specificEnthalpy );
7374 if (temperature != null ) tag .putFloat ("temperature" , temperature );
74- if (pressure != null ) tag .putFloat ("pressure" , pressure );
75- if (specificEnthalpy != null ) tag .putFloat ("specific_enthalpy" , specificEnthalpy );
7675 if (specificEntropy != null ) tag .putFloat ("specific_entropy" , specificEntropy );
7776 if (vaporQuality != null ) tag .putFloat ("vapor_quality" , vaporQuality );
7877 return tag ;
7978 }
8079
81- public @ NotNull Float temperature () {
80+ public Float temperature () {
8281 if (temperature == null ) {
8382 temperature = FullTableBased .getT (pressure , specificEnthalpy );
8483 }
8584 return temperature ;
8685 }
8786
88- public @ NotNull Float specificEntropy () {
87+ public Float specificEntropy () {
8988 if (specificEntropy == null ) {
9089 specificEntropy = FullTableBased .getS (pressure , specificEnthalpy );
9190 }
9291 return specificEntropy ;
9392 }
9493
95- public @ NotNull Float vaporQuality () {
94+ public Float vaporQuality () {
9695 if (vaporQuality == null ) {
9796 vaporQuality = FullTableBased .getX (pressure , specificEnthalpy );
9897 }
0 commit comments