Skip to content

Commit 5aeca54

Browse files
fix: docstrings broke code
1 parent cf119cf commit 5aeca54

File tree

1 file changed

+26
-25
lines changed

1 file changed

+26
-25
lines changed

src/main/java/com/tcm/MineTale/block/entity/ChickenCoopEntity.java

Lines changed: 26 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,32 @@ public <T> TypedOutputList<T> list(String key, Codec<T> codec) {
492492
}
493493
}
494494

495+
private record ChickenTypedOutputList<T>(ListTag list, Codec<T> codec, HolderLookup.Provider registries) implements TypedOutputList<T> {
496+
/**
497+
* Encodes a value with the list's codec and appends the resulting NBT element to the backing list.
498+
*
499+
* @param value the item to encode and add
500+
* If encoding fails the error is logged and the value is not added.
501+
*/
502+
@Override
503+
public void add(T value) {
504+
// serialize the object into NBT and add it to the list if successful
505+
codec.encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), value)
506+
.resultOrPartial(System.err::println)
507+
.ifPresent(list::add);
508+
}
509+
510+
/**
511+
* Checks whether the output list contains no elements.
512+
*
513+
* @return `true` if the list contains no elements, `false` otherwise.
514+
*/
515+
@Override
516+
public boolean isEmpty() {
517+
return list.isEmpty();
518+
}
519+
}
520+
495521
private record ChickenValueOutputList(ListTag list, HolderLookup.Provider registries) implements ValueOutputList {
496522
/**
497523
* Create a new child output element and append it to the list.
@@ -529,31 +555,6 @@ public boolean isEmpty() {
529555
}
530556
}
531557

532-
private record ChickenTypedOutputList<T>(ListTag list, Codec<T> codec, HolderLookup.Provider registries) implements TypedOutputList<T> {
533-
/**
534-
* Encodes a value with the list's codec and appends the resulting NBT element to the backing list.
535-
*
536-
* @param value the item to encode and add
537-
* If encoding fails the error is logged and the value is not added.
538-
@Override
539-
public void add(T value) {
540-
// serialize the object into NBT and add it to the list if successful
541-
codec.encodeStart(registries.createSerializationContext(NbtOps.INSTANCE), value)
542-
.resultOrPartial(System.err::println)
543-
.ifPresent(list::add);
544-
}
545-
546-
/**
547-
* Checks whether the output list contains no elements.
548-
*
549-
* @return `true` if the list contains no elements, `false` otherwise.
550-
*/
551-
@Override
552-
public boolean isEmpty() {
553-
return list.isEmpty();
554-
}
555-
}
556-
557558
private static class ChickenValueInput implements ValueInput {
558559
private final CompoundTag tag;
559560
private final HolderLookup.Provider registries;

0 commit comments

Comments
 (0)