This does something idk.

This commit is contained in:
wizjany
2019-05-12 14:19:46 -04:00
committed by Matthew Miller
parent 2571efb5c3
commit dc21b4df58
6 changed files with 57 additions and 11 deletions

View File

@ -345,9 +345,9 @@ public class CuboidRegion extends AbstractRegion implements FlatRegion {
BlockVector3 answer = BlockVector3.at(nextX, nextY, nextZ);
if (++nextX > max.getBlockX()) {
nextX = min.getBlockX();
if (++nextY > max.getBlockY()) {
nextY = min.getBlockY();
if (++nextZ > max.getBlockZ()) {
if (++nextZ > max.getBlockZ()) {
nextZ = min.getBlockZ();
if (++nextY > max.getBlockY()) {
nextX = Integer.MIN_VALUE;
}
}

View File

@ -46,7 +46,7 @@ import java.util.Set;
*/
@SuppressWarnings("unchecked")
public class BlockState implements BlockStateHolder<BlockState> {
static {
BlockStateIdAccess.setBlockStateStateId(x -> x.internalId);
}
@ -86,13 +86,14 @@ public class BlockState implements BlockStateHolder<BlockState> {
List<List<Object>> valueLists = Lists.cartesianProduct(separatedValues);
for (List<Object> valueList : valueLists) {
Map<Property<?>, Object> valueMap = Maps.newTreeMap(Comparator.comparing(Property::getName));
BlockState stateMaker = new BlockState(blockType).initializeId(registry);
BlockState stateMaker = new BlockState(blockType);
for (int i = 0; i < valueList.size(); i++) {
Property<?> property = properties.get(i);
Object value = valueList.get(i);
valueMap.put(property, value);
stateMaker.setState(property, value);
}
stateMaker.initializeId(registry);
stateMap.put(valueMap, stateMaker);
}
}

View File

@ -67,4 +67,11 @@ public interface BlockRegistry {
*/
OptionalInt getInternalBlockStateId(BlockState state);
/**
* Retrieve a block state by its internal ID, if possible.
*
* @param id The internal ID
* @return the block state, if available
*/
BlockState getBlockStateByInternalId(int id);
}

View File

@ -59,4 +59,9 @@ public class BundledBlockRegistry implements BlockRegistry {
return OptionalInt.empty();
}
@Override
public BlockState getBlockStateByInternalId(int id) {
return null;
}
}