another fix

This commit is contained in:
Zoë Gidiere
2023-12-12 16:06:31 -07:00
parent 47c8cb3168
commit 6f03746e41
4 changed files with 11 additions and 9 deletions

View File

@@ -6,10 +6,8 @@ import cloud.commandframework.arguments.standard.EnumArgument;
import cloud.commandframework.arguments.standard.LongArgument;
import cloud.commandframework.context.CommandContext;
import com.dfsek.terra.addons.manifest.api.MonadAddonInitializer;
import com.dfsek.terra.addons.manifest.api.monad.Do;
import com.dfsek.terra.addons.manifest.api.monad.Get;
import com.dfsek.terra.addons.manifest.api.monad.Init;
import com.dfsek.terra.addons.manifest.api.AddonInitializer;
import com.dfsek.terra.api.Platform;
import com.dfsek.terra.api.addon.BaseAddon;
import com.dfsek.terra.api.command.CommandSender;
@@ -59,7 +57,11 @@ public class StructureCommandAddon implements AddonInitializer {
structure.generate(
sender.position().toInt(),
sender.world(),
((Long) context.get("seed") == 0) ? new Random() : new Random(context.get("seed")),
((Long) context.get("seed") == 0)
? RandomGeneratorFactory.<RandomGenerator.SplittableGenerator>of("Xoroshiro128PlusPlus")
.create()
: RandomGeneratorFactory.<RandomGenerator.SplittableGenerator>of("Xoroshiro128PlusPlus")
.create(context.get("seed")),
context.get("rotation")
);
})

View File

@@ -26,7 +26,7 @@ public class PaddedGridDistributor implements Distributor {
int cellZ = Math.floorDiv(z, cellWidth);
RandomGenerator random = RandomGeneratorFactory.<RandomGenerator.SplittableGenerator>of("Xoroshiro128PlusPlus").create(
(murmur64(MathUtil.squash(cellX, cellZ)) ^ seed) + salt);
(MathUtil.murmur64(MathUtil.squash(cellX, cellZ)) ^ seed) + salt);
int pointX = random.nextInt(width) + cellX * cellWidth;
int pointZ = random.nextInt(width) + cellZ * cellWidth;

View File

@@ -44,7 +44,7 @@ public class VanillaOre implements Structure {
}
@Override
public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation) {
public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) {
float randomRadian = random.nextFloat() * (float) Math.PI;
double eighthSize = size / 8.0F;

View File

@@ -66,10 +66,10 @@ public class LootFunction implements Function<Void> {
registry.get(RegistryKey.parse(id))
.ifPresentOrElse(table -> {
Vector3 apply = Vector3.of(FastMath.roundToInt(xz.getX()),
Vector3 apply = Vector3.of((int) Math.round(xz.getX()),
y.apply(implementationArguments, scope)
.intValue(),
FastMath.roundToInt(xz.getZ())).mutable().add(arguments.getOrigin()).immutable();
(int) Math.round(xz.getZ())).mutable().add(arguments.getOrigin()).immutable();
try {
BlockEntity data = arguments.getWorld().getBlockEntity(apply);