File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
Common/src/main/java/net/darkhax/bookshelf/api/serialization Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 99import net .minecraft .nbt .Tag ;
1010import net .minecraft .network .FriendlyByteBuf ;
1111
12+ import javax .annotation .Nullable ;
1213import java .util .ArrayList ;
1314import java .util .HashSet ;
1415import java .util .List ;
@@ -125,9 +126,9 @@ default T fromNBT(CompoundTag tag, String name) {
125126 throw new NBTParseException ("Required tag " + name + " was not present." );
126127 }
127128
128- default T fromNBT (CompoundTag tag , String name , T fallback ) {
129+ default T fromNBT (@ Nullable CompoundTag tag , String name , T fallback ) {
129130
130- return tag .contains (name ) ? this .fromNBT (tag .get (name )) : fallback ;
131+ return tag != null && tag .contains (name ) ? this .fromNBT (tag .get (name )) : fallback ;
131132 }
132133
133134 default void toNBT (CompoundTag tag , String name , T toWrite ) {
You can’t perform that action at this time.
0 commit comments