mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-07-05 12:36:40 +00:00
This commit is contained in:
@ -85,17 +85,27 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
|
||||
|
||||
private static long combine(Direction... directions) {
|
||||
return Arrays.stream(directions).mapToLong(dir -> (1L << dir.ordinal())).reduce(0, (a, b) -> a | b);
|
||||
long mask = 0;
|
||||
for (Direction dir : directions) {
|
||||
mask = mask | (1L << dir.ordinal());
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
private static long[] adapt(Direction... dirs) {
|
||||
long[] arr = new long[dirs.length];
|
||||
Arrays.setAll(arr, i -> 1L << dirs[i].ordinal());
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
arr[i] = 1L << dirs[i].ordinal();
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
private static long[] adapt(Long... dirs) {
|
||||
return Arrays.stream(dirs).mapToLong(dir -> dir).toArray();
|
||||
long[] arr = new long[dirs.length];
|
||||
for (int i = 0; i < arr.length; i++) {
|
||||
arr[i] = dirs[i];
|
||||
}
|
||||
return arr;
|
||||
}
|
||||
|
||||
private static long[] getDirections(AbstractProperty property) {
|
||||
@ -209,7 +219,9 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
}
|
||||
|
||||
private static long notIndex(long mask, int... indexes) {
|
||||
mask |= Arrays.stream(indexes).mapToLong(index -> (1L << (index + values().length))).reduce(0, (a, b) -> a | b);
|
||||
for (int index : indexes) {
|
||||
mask = mask | (1L << (index + values().length));
|
||||
}
|
||||
return mask;
|
||||
}
|
||||
|
||||
@ -421,8 +433,7 @@ public class BlockTransformExtent extends ResettableExtent {
|
||||
* @return the same block
|
||||
*/
|
||||
public static <B extends BlockStateHolder<B>> B transform(B block, Transform transform) {
|
||||
checkNotNull(block);
|
||||
checkNotNull(transform);
|
||||
// performance critical
|
||||
BlockState state = block.toImmutableState();
|
||||
|
||||
int transformedId = transformState(state, transform);
|
||||
|
Reference in New Issue
Block a user