resolve conflicts

This commit is contained in:
Jesse Boyd
2019-07-18 16:56:57 +10:00
parent dd38cbe750
commit be8213d8ee
49 changed files with 1819 additions and 1722 deletions

View File

@ -51,6 +51,7 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Map;
/**
@ -94,19 +95,11 @@ public class BlockTransformExtent extends ResettableExtent {
}
private static long[] adapt(Direction... dirs) {
long[] arr = new long[dirs.length];
for (int i = 0; i < arr.length; i++) {
arr[i] = 1L << dirs[i].ordinal();
}
return arr;
return Arrays.stream(dirs).mapToLong(dir -> 1L << dir.ordinal()).toArray();
}
private static long[] adapt(Long... dirs) {
long[] arr = new long[dirs.length];
for (int i = 0; i < arr.length; i++) {
arr[i] = dirs[i];
}
return arr;
return Arrays.stream(dirs).mapToLong(dir -> dir).toArray();
}
private static long[] getDirections(AbstractProperty property) {
@ -138,7 +131,7 @@ public class BlockTransformExtent extends ResettableExtent {
case FACING: {
List<Direction> directions = new ArrayList<>();
for (Object value : values) {
directions.add(Direction.valueOf(value.toString().toUpperCase()));
directions.add(Direction.valueOf(value.toString().toUpperCase(Locale.ROOT)));
}
return adapt(directions.toArray(new Direction[0]));
}
@ -220,9 +213,7 @@ public class BlockTransformExtent extends ResettableExtent {
}
private static long notIndex(long mask, int... indexes) {
for (int index : indexes) {
mask = mask | (1L << (index + values().length));
}
mask |= Arrays.stream(indexes).mapToLong(index -> (1L << (index + values().length))).reduce(0, (a, b) -> a | b);
return mask;
}
@ -344,10 +335,10 @@ public class BlockTransformExtent extends ResettableExtent {
Object southState = tmp.getState(PropertyKey.SOUTH);
Object westState = tmp.getState(PropertyKey.WEST);
tmp = tmp.with(PropertyKey.valueOf(newNorth.name().toUpperCase()), northState);
tmp = tmp.with(PropertyKey.valueOf(newEast.name().toUpperCase()), eastState);
tmp = tmp.with(PropertyKey.valueOf(newSouth.name().toUpperCase()), southState);
tmp = tmp.with(PropertyKey.valueOf(newWest.name().toUpperCase()), westState);
tmp = tmp.with(PropertyKey.valueOf(newNorth.name().toUpperCase(Locale.ROOT)), northState);
tmp = tmp.with(PropertyKey.valueOf(newEast.name().toUpperCase(Locale.ROOT)), eastState);
tmp = tmp.with(PropertyKey.valueOf(newSouth.name().toUpperCase(Locale.ROOT)), southState);
tmp = tmp.with(PropertyKey.valueOf(newWest.name().toUpperCase(Locale.ROOT)), westState);
newMaskedId = tmp.getInternalId();
}
@ -476,7 +467,7 @@ public class BlockTransformExtent extends ResettableExtent {
return BlockState.getFromInternalId(newMaskedId);
}
public final BaseBlock transform(BlockStateHolder block) {
public final BaseBlock transform(BlockStateHolder<BaseBlock> block) {
BlockState transformed = transform(block.toImmutableState());
if (block.hasNbtData()) {
return transformBaseBlockNBT(transformed, block.getNbtData(), transform);
@ -501,13 +492,8 @@ public class BlockTransformExtent extends ResettableExtent {
}
@Override
public BlockState getLazyBlock(int x, int y, int z) {
return transform(super.getLazyBlock(x, y, z));
}
@Override
public BlockState getLazyBlock(BlockVector3 position) {
return transform(super.getLazyBlock(position));
public BlockState getBlock(int x, int y, int z) {
return transform(super.getBlock(x, y, z));
}
@Override