Skip to content

Commit

Permalink
Merge 52fbb72 into 04bad90
Browse files Browse the repository at this point in the history
  • Loading branch information
ens-gijs committed Nov 12, 2021
2 parents 04bad90 + 52fbb72 commit 2cc4854
Show file tree
Hide file tree
Showing 25 changed files with 1,971 additions and 595 deletions.
36 changes: 36 additions & 0 deletions src/main/java/net/querz/mca/BlockStateIterator.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
package net.querz.mca;

import net.querz.nbt.tag.CompoundTag;

import java.util.Iterator;

/**
* Enhanced iterable/iterator for iterating over {@link Section} block data.
* See {@link Section#blocksStates()}
*/
public interface BlockStateIterator extends Iterable<CompoundTag>, Iterator<CompoundTag> {
/**
* Sets the block state for the current block.
* Be careful to remember that the block state tag returned by this iterator is a reference
* that will affect all blocks using that tag. If your intention is to modify "just this one block"
* then copy the tag before modification - then call this function.
* @param state State to set. Must not be null.
*/
void setBlockStateAtCurrent(CompoundTag state);

/**
* Performs palette and block state cleanup if, and only if, changes were made via this iterator.
*/
void cleanupPaletteAndBlockStatesIfDirty();

/** current block index (in range 0-4095) */
int currentIndex();
/** current block x within section (in range 0-15) */
int currentX();
/** current block z within section (in range 0-15) */
int currentZ();
/** current block y within section (in range 0-15) */
int currentY();
/** current block world level y */
int currentBlockY();
}

0 comments on commit 2cc4854

Please sign in to comment.