Skip to content

Commit 474c74b

Browse files
author
verbuchselt
committed
Added the ability of reading/writing lists of NBT classes!
Works perfectly with MapChunk-Packet's TileEntity-Data!
1 parent caaa57c commit 474c74b

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

modules/API/src/main/java/com/comphenix/protocol/events/PacketContainer.java

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -520,6 +520,21 @@ public StructureModifier<NbtBase<?>> getNbtModifier() {
520520
BukkitConverters.getNbtConverter());
521521
}
522522

523+
/**
524+
* Retrieves a read/write structure for lists of NBT classes.
525+
* @return A modifier for lists of NBT classes.
526+
*/
527+
public StructureModifier<List<NbtBase<?>>> getListNbtModifier() {
528+
// Convert to and from the ProtocolLib wrapper
529+
return structureModifier.withType(
530+
Collection.class,
531+
BukkitConverters.getListConverter(
532+
MinecraftReflection.getNBTBaseClass(),
533+
BukkitConverters.getNbtConverter()
534+
)
535+
);
536+
}
537+
523538
/**
524539
* Retrieves a read/write structure for Vectors.
525540
* @return A modifier for Vectors.

0 commit comments

Comments
 (0)