Tenanea generator prototype
This commit is contained in:
parent
8aa8d1463a
commit
1a4eaa7c6e
6 changed files with 156 additions and 0 deletions
|
@ -87,6 +87,15 @@ public class BlocksHelper {
|
|||
}
|
||||
return pos.getY() - POS.getY();
|
||||
}
|
||||
|
||||
public static int raycastSqr(WorldAccess world, BlockPos pos, int dx, int dy, int dz, int maxDist) {
|
||||
POS.set(pos);
|
||||
for (int j = 1; j < maxDist && (world.getBlockState(POS)).getMaterial().isReplaceable(); j++)
|
||||
{
|
||||
POS.move(dx, dy, dz);
|
||||
}
|
||||
return (int) pos.getSquaredDistance(POS);
|
||||
}
|
||||
|
||||
public static BlockState rotateHorizontal(BlockState state, BlockRotation rotation, Property<Direction> facing) {
|
||||
return (BlockState) state.with(facing, rotation.rotate((Direction) state.get(facing)));
|
||||
|
|
|
@ -124,4 +124,13 @@ public class MHelper {
|
|||
h = (h ^ (h >> 13)) * 1274126177;
|
||||
return h ^ (h >> 16);
|
||||
}
|
||||
|
||||
public static <T> void shuffle(T[] array, Random random) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
int i2 = random.nextInt(array.length);
|
||||
T element = array[i];
|
||||
array[i] = array[i2];
|
||||
array[i2] = element;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue