Fix up random changes

This commit is contained in:
Zoë Gidiere 2023-12-12 16:00:56 -07:00
parent a9f973cae9
commit 47c8cb3168
3 changed files with 10 additions and 10 deletions

View File

@ -1,7 +1,7 @@
package com.dfsek.terra.addons.ore.ores;
import java.util.Map;
import java.util.Random;
import java.util.random.RandomGenerator;
import com.dfsek.terra.api.block.BlockType;
import com.dfsek.terra.api.block.state.BlockState;
@ -24,7 +24,7 @@ public class VanillaScatteredOre extends VanillaOre {
}
@Override
public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation) {
public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) {
int i = random.nextInt((int) (size + 1));
Vector3Int.Mutable mutable = Vector3Int.zero().mutable();
@ -39,7 +39,7 @@ public class VanillaScatteredOre extends VanillaOre {
return true;
}
private void setPos(Vector3Int.Mutable mutable, Random random, Vector3Int location, int spread) {
private void setPos(Vector3Int.Mutable mutable, RandomGenerator random, Vector3Int location, int spread) {
int x = this.getSpread(random, spread);
int y = this.getSpread(random, spread);
int z = this.getSpread(random, spread);
@ -48,7 +48,7 @@ public class VanillaScatteredOre extends VanillaOre {
mutable.setZ(location.getZ() + z);
}
private int getSpread(Random random, int spread) {
private int getSpread(RandomGenerator random, int spread) {
return Math.round((random.nextFloat() - random.nextFloat()) * (float) spread);
}
}

View File

@ -1,20 +1,20 @@
package com.dfsek.terra.addons.ore.utils;
import java.util.Random;
import com.dfsek.terra.api.block.BlockType;
import com.dfsek.terra.api.util.collection.MaterialSet;
import com.dfsek.terra.api.world.WritableWorld;
import java.util.random.RandomGenerator;
public class VanillaOreUtils {
private static boolean shouldExpose(Random random, double exposedChance) {
private static boolean shouldExpose(RandomGenerator random, double exposedChance) {
if(exposedChance >= 1.0F) return true;
if(exposedChance <= 0.0F) return false;
return random.nextFloat() < exposedChance;
}
public static boolean shouldPlace(MaterialSet replaceable, BlockType type, Double exposedChance, Random random, WritableWorld world,
public static boolean shouldPlace(MaterialSet replaceable, BlockType type, Double exposedChance, RandomGenerator random, WritableWorld world,
int x,
int y, int z) {
if(!replaceable.contains(type)) return false;

View File

@ -5,12 +5,12 @@ import org.bukkit.generator.LimitedRegion;
import org.bukkit.generator.WorldInfo;
import org.jetbrains.annotations.NotNull;
import java.util.Random;
import com.dfsek.terra.api.block.state.BlockState;
import com.dfsek.terra.api.config.ConfigPack;
import com.dfsek.terra.bukkit.world.BukkitProtoWorld;
import java.util.Random;
public class BukkitBlockPopulator extends BlockPopulator {
private final BlockState air;