mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-18 10:32:30 +00:00
Fix up random changes
This commit is contained in:
parent
a9f973cae9
commit
47c8cb3168
@ -1,7 +1,7 @@
|
|||||||
package com.dfsek.terra.addons.ore.ores;
|
package com.dfsek.terra.addons.ore.ores;
|
||||||
|
|
||||||
import java.util.Map;
|
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.BlockType;
|
||||||
import com.dfsek.terra.api.block.state.BlockState;
|
import com.dfsek.terra.api.block.state.BlockState;
|
||||||
@ -24,7 +24,7 @@ public class VanillaScatteredOre extends VanillaOre {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@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));
|
int i = random.nextInt((int) (size + 1));
|
||||||
Vector3Int.Mutable mutable = Vector3Int.zero().mutable();
|
Vector3Int.Mutable mutable = Vector3Int.zero().mutable();
|
||||||
|
|
||||||
@ -39,7 +39,7 @@ public class VanillaScatteredOre extends VanillaOre {
|
|||||||
return true;
|
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 x = this.getSpread(random, spread);
|
||||||
int y = this.getSpread(random, spread);
|
int y = this.getSpread(random, spread);
|
||||||
int z = this.getSpread(random, spread);
|
int z = this.getSpread(random, spread);
|
||||||
@ -48,7 +48,7 @@ public class VanillaScatteredOre extends VanillaOre {
|
|||||||
mutable.setZ(location.getZ() + z);
|
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);
|
return Math.round((random.nextFloat() - random.nextFloat()) * (float) spread);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,20 +1,20 @@
|
|||||||
package com.dfsek.terra.addons.ore.utils;
|
package com.dfsek.terra.addons.ore.utils;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.block.BlockType;
|
import com.dfsek.terra.api.block.BlockType;
|
||||||
import com.dfsek.terra.api.util.collection.MaterialSet;
|
import com.dfsek.terra.api.util.collection.MaterialSet;
|
||||||
import com.dfsek.terra.api.world.WritableWorld;
|
import com.dfsek.terra.api.world.WritableWorld;
|
||||||
|
|
||||||
|
import java.util.random.RandomGenerator;
|
||||||
|
|
||||||
|
|
||||||
public class VanillaOreUtils {
|
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 >= 1.0F) return true;
|
||||||
if(exposedChance <= 0.0F) return false;
|
if(exposedChance <= 0.0F) return false;
|
||||||
return random.nextFloat() < exposedChance;
|
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 x,
|
||||||
int y, int z) {
|
int y, int z) {
|
||||||
if(!replaceable.contains(type)) return false;
|
if(!replaceable.contains(type)) return false;
|
||||||
|
@ -5,12 +5,12 @@ import org.bukkit.generator.LimitedRegion;
|
|||||||
import org.bukkit.generator.WorldInfo;
|
import org.bukkit.generator.WorldInfo;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import com.dfsek.terra.api.block.state.BlockState;
|
import com.dfsek.terra.api.block.state.BlockState;
|
||||||
import com.dfsek.terra.api.config.ConfigPack;
|
import com.dfsek.terra.api.config.ConfigPack;
|
||||||
import com.dfsek.terra.bukkit.world.BukkitProtoWorld;
|
import com.dfsek.terra.bukkit.world.BukkitProtoWorld;
|
||||||
|
|
||||||
|
import java.util.Random;
|
||||||
|
|
||||||
|
|
||||||
public class BukkitBlockPopulator extends BlockPopulator {
|
public class BukkitBlockPopulator extends BlockPopulator {
|
||||||
private final BlockState air;
|
private final BlockState air;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user