Skip to content

Commit 015be71

Browse files
committed
Flavor is null
1 parent cb9424b commit 015be71

File tree

1 file changed

+4
-2
lines changed
  • common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/curry

1 file changed

+4
-2
lines changed

common/src/main/java/generations/gg/generations/core/generationscore/common/world/item/curry/CurryData.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public ResourceLocation getResourceLocation() {
126126

127127
public Tag toNbt() {
128128
CompoundTag nbt = new CompoundTag();
129-
nbt.putInt("flavor", flavor.ordinal());
129+
nbt.putInt("flavor", flavor == null ? -1 : flavor.ordinal());
130130
nbt.putInt("type", curryType.ordinal());
131131
nbt.putInt("rating", rating.ordinal());
132132
nbt.putInt("experience", experience);
@@ -144,7 +144,9 @@ public static CurryData fromNbt(CompoundTag nbt) {
144144
return curry;
145145
}
146146

147-
return curry.setFlavor(Flavor.values()[nbt.getInt("flavor")])
147+
var flavor = nbt.getInt("flavor");
148+
149+
return curry.setFlavor(flavor == -1 ? null : Flavor.values()[flavor])
148150
.setCurryType(CurryType.getCurryTypeFromIndex(nbt.getInt("type")))
149151
.setRating(CurryTasteRating.fromId(nbt.getInt("rating")))
150152
.setExperience(nbt.getInt("experience"))

0 commit comments

Comments
 (0)