This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| typedef struct { | |
| int head; | |
| int item_size; | |
| int* items; | |
| } Stack; | |
| void | |
| initialize_stack(Stack* stack, const int size) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <stdio.h> | |
| #include <stdlib.h> | |
| #include <string.h> | |
| char* | |
| join_string(const int elements, char** arr) | |
| { | |
| size_t lengths[elements]; | |
| size_t len = 0; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| val palette = it.getLongArray("BlockStates") | |
| val bits = palette.size.logCap(2) | |
| val maxEntryValue = (1 shl bits) - 1L | |
| for (y in 0 until ySizeAbs) { | |
| for (z in 0 until zSizeAbs) { | |
| for (x in 0 until xSizeAbs) { | |
| val index = (y * xSizeAbs * zSizeAbs) + z * xSizeAbs + x | |
| val startOffset = index * bits |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class VarIntIterator( | |
| private val bytes: ByteArray, | |
| private val bitsPerEntry: Int = 7, | |
| private val maxGroups: Int = 5, | |
| ) : Iterator<Int> { | |
| private var index: Int = 0 | |
| override fun hasNext(): Boolean = index < bytes.size | |
| override fun next(): Int { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun StructureTemplate.readSpongeV1OrException( | |
| lookup: RegistryEntryLookup<Block>, | |
| nbt: NbtCompound, | |
| ): Throwable? { | |
| val version = nbt.getInt("DataVersion") | |
| val width = (nbt.getShort("Width") and 0xFFFF.toShort()).toInt() | |
| val height = (nbt.getShort("Height") and 0xFFFF.toShort()).toInt() | |
| val length = (nbt.getShort("Length") and 0xFFFF.toShort()).toInt() | |
| val metadata = nbt.getCompound("Metadata") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fun StructureTemplate.readLitematicaOrException( | |
| lookup: RegistryEntryLookup<Block>, | |
| nbt: NbtCompound, | |
| ): Throwable? { | |
| val version = nbt.getInt("MinecraftDataVersion") | |
| val metadata = nbt.getCompound("Metadata") | |
| val author = metadata.getString("Author") | |
| val size = metadata.getVector("EnclosingSize") |