Skip to content

Commit

Permalink
More random house cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
avaerian committed Sep 4, 2023
1 parent 366bfc8 commit 33116a2
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 25 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,5 @@
import org.minerift.ether.schematic.SchematicFileReadException;

public interface IReaderStep {

// Returns whether the data was successfully read or not
void read(ReaderContext ctx) throws SchematicFileReadException;

}
26 changes: 13 additions & 13 deletions main/src/main/java/org/minerift/ether/util/nbt/NBTTagType.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@

public enum NBTTagType {

END_TAG(0, "TAG_End", EndTag.class),
BYTE_TAG(1, "TAG_Byte", ByteTag.class),
SHORT_TAG(2, "TAG_Short", ShortTag.class),
INT_TAG(3, "TAG_Int", IntTag.class),
LONG_TAG(4, "TAG_Long", LongTag.class),
FLOAT_TAG(5, "TAG_Float", FloatTag.class),
DOUBLE_TAG(6, "TAG_Double", DoubleTag.class),
BYTE_ARRAY_TAG(7, "TAG_Byte_Array", ByteArrayTag.class),
STRING_TAG(8, "TAG_String", StringTag.class),
LIST_TAG(9, "TAG_List", ListTag.class),
COMPOUND_TAG(10, "TAG_Compound", CompoundTag.class),
INT_ARRAY_TAG(11, "TAG_Int_Array", IntArrayTag.class),
LONG_ARRAY_TAG(12, "TAG_Long_Array", LongArrayTag.class);
END_TAG (0, "TAG_End", EndTag.class),
BYTE_TAG (1, "TAG_Byte", ByteTag.class),
SHORT_TAG (2, "TAG_Short", ShortTag.class),
INT_TAG (3, "TAG_Int", IntTag.class),
LONG_TAG (4, "TAG_Long", LongTag.class),
FLOAT_TAG (5, "TAG_Float", FloatTag.class),
DOUBLE_TAG (6, "TAG_Double", DoubleTag.class),
BYTE_ARRAY_TAG (7, "TAG_Byte_Array", ByteArrayTag.class),
STRING_TAG (8, "TAG_String", StringTag.class),
LIST_TAG (9, "TAG_List", ListTag.class),
COMPOUND_TAG (10, "TAG_Compound", CompoundTag.class),
INT_ARRAY_TAG (11, "TAG_Int_Array", IntArrayTag.class),
LONG_ARRAY_TAG (12, "TAG_Long_Array", LongArrayTag.class);

public static NBTTagType getTagType(Class<? extends Tag> clazz) {
for(NBTTagType type : values()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -271,20 +271,19 @@ public BlockPartition(List<BlockArchetype> blocks, World world, GetChunkFunction
this.chunkGetter = chunkGetter;
this.totalBlockCount = 0;
addAll(blocks);
findRegionBounds();

// TODO: handle this better for cases of no blocks
this.bottomLeft = null;
this.topRight = null;
if(!partition.isEmpty()) {
findRegionBounds();
}
}

private void findRegionBounds() {

final Set<LevelChunk> chunks = getChunks();

// TODO: handle this better for cases of no blocks
if(partition.isEmpty()) {
this.bottomLeft = null;
this.topRight = null;
return;
}

// Handle for single chunk
if(chunks.size() == 1) {
ChunkPos pos = chunks.iterator().next().getPos();
Expand Down Expand Up @@ -333,7 +332,9 @@ public ChunkPos getTopRightBound() {
}

public Set<ChunkPos> getChunksForRelighting() {
return getNeighboringChunks(bottomLeft, topRight);
return partition.isEmpty()
? Collections.emptySet()
: getNeighboringChunks(bottomLeft, topRight);
}

public void add(BlockArchetype block) {
Expand Down

0 comments on commit 33116a2

Please sign in to comment.