From 145eed893a0be47371c78d6b4d4ef02aa4bcaa9c Mon Sep 17 00:00:00 2001 From: dfsek Date: Sat, 16 Jul 2022 03:34:59 -0700 Subject: [PATCH 01/11] fix #264 with artifacting --- .../biome/pipeline/BiomeHolderImpl.java | 66 +++++++++++-------- .../addons/biome/pipeline/BiomePipeline.java | 21 ++++-- .../biome/pipeline/api/BiomeHolder.java | 6 +- .../biome/pipeline/api/stage/Stage.java | 2 +- .../config/BiomePipelineTemplate.java | 2 +- .../biome/pipeline/stages/ExpanderStage.java | 4 +- .../biome/pipeline/stages/MutatorStage.java | 4 +- 7 files changed, 60 insertions(+), 45 deletions(-) diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomeHolderImpl.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomeHolderImpl.java index 57304011b..1910513a6 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomeHolderImpl.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomeHolderImpl.java @@ -12,69 +12,77 @@ import com.dfsek.terra.addons.biome.pipeline.api.delegate.BiomeDelegate; import com.dfsek.terra.addons.biome.pipeline.api.stage.type.BiomeExpander; import com.dfsek.terra.addons.biome.pipeline.api.stage.type.BiomeMutator; import com.dfsek.terra.addons.biome.pipeline.source.BiomeSource; -import com.dfsek.terra.api.util.vector.Vector2; public class BiomeHolderImpl implements BiomeHolder { - private final Vector2.Mutable origin; private final int width; private final int offset; + private final double totalWidth; + private final int originalWidth; private BiomeDelegate[][] biomes; - public BiomeHolderImpl(int width, Vector2.Mutable origin) { + public BiomeHolderImpl(int width, double totalWidth) { + this.totalWidth = totalWidth; + this.originalWidth = width; width += 4; this.width = width; biomes = new BiomeDelegate[width][width]; - this.origin = origin; this.offset = 2; } - private BiomeHolderImpl(BiomeDelegate[][] biomes, Vector2.Mutable origin, int width, int offset) { + private BiomeHolderImpl(BiomeDelegate[][] biomes, int width, int offset, double totalWidth, int originalWidth) { this.biomes = biomes; - this.origin = origin; this.width = width; this.offset = 2 * offset; + this.totalWidth = totalWidth; + this.originalWidth = originalWidth; + } + + private double normalise(double in) { + return totalWidth * ((in - offset) / originalWidth); } @Override - public BiomeHolder expand(BiomeExpander expander, long seed) { + public BiomeHolder expand(BiomeExpander expander, int x, int z, long seed) { BiomeDelegate[][] old = biomes; int newWidth = width * 2 - 1; biomes = new BiomeDelegate[newWidth][newWidth]; - for(int x = 0; x < width; x++) { - for(int z = 0; z < width; z++) { - biomes[x * 2][z * 2] = old[x][z]; - if(z != width - 1) - biomes[x * 2][z * 2 + 1] = expander.getBetween(x + origin.getX(), z + 1 + origin.getZ(), seed, old[x][z], - old[x][z + 1]); - if(x != width - 1) - biomes[x * 2 + 1][z * 2] = expander.getBetween(x + 1 + origin.getX(), z + origin.getZ(), seed, old[x][z], - old[x + 1][z]); - if(x != width - 1 && z != width - 1) - biomes[x * 2 + 1][z * 2 + 1] = expander.getBetween(x + 1 + origin.getX(), z + 1 + origin.getZ(), seed, old[x][z], - old[x + 1][z + 1], old[x][z + 1], old[x + 1][z]); + + for(int xi = 0; xi < width; xi++) { + for(int zi = 0; zi < width; zi++) { + biomes[xi * 2][zi * 2] = old[xi][zi]; + if(zi != width - 1) + biomes[xi * 2][zi * 2 + 1] = expander.getBetween(normalise(xi) + x, normalise(zi + 1) + z, seed, old[xi][zi], + old[xi][zi + 1]); + if(xi != width - 1) + biomes[xi * 2 + 1][zi * 2] = expander.getBetween(normalise(xi + 1) + x, normalise(zi) + z, seed, old[xi][zi], + old[xi + 1][zi]); + if(xi != width - 1 && zi != width - 1) + biomes[xi * 2 + 1][zi * 2 + 1] = expander.getBetween(normalise(xi + 1) + x, normalise(zi + 1) + z, seed, + old[xi][zi], + old[xi + 1][zi + 1], old[xi][zi + 1], old[xi + 1][zi]); } } - return new BiomeHolderImpl(biomes, origin.setX(origin.getX() * 2 - 1).setZ(origin.getZ() * 2 - 1), newWidth, offset); + return new BiomeHolderImpl(biomes, newWidth, offset, totalWidth, originalWidth * 2 - 1); } @Override - public void mutate(BiomeMutator mutator, long seed) { - for(int x = 0; x < width; x++) { - for(int z = 0; z < width; z++) { - BiomeMutator.ViewPoint viewPoint = new BiomeMutator.ViewPoint(this, x, z); - biomes[x][z] = mutator.mutate(viewPoint, x + origin.getX(), z + origin.getZ(), seed); + public void mutate(BiomeMutator mutator, int x, int z, long seed) { + for(int xi = 0; xi < width; xi++) { + for(int zi = 0; zi < width; zi++) { + BiomeMutator.ViewPoint viewPoint = new BiomeMutator.ViewPoint(this, xi, zi); + biomes[xi][zi] = mutator.mutate(viewPoint, normalise(xi) + x, normalise(zi) + z, seed); } } } @Override - public void fill(BiomeSource source, long seed) { - for(int x = 0; x < width; x++) { - for(int z = 0; z < width; z++) { - biomes[x][z] = source.getBiome(origin.getX() + x, origin.getZ() + z, seed); + public void fill(BiomeSource source, int x, int z, long seed) { + for(int xi = 0; xi < width; xi++) { + for(int zi = 0; zi < width; zi++) { + biomes[xi][zi] = source.getBiome(normalise(xi) + x, normalise(zi) + z, seed); } } } diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomePipeline.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomePipeline.java index 8a4be5d7d..19dbb7896 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomePipeline.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomePipeline.java @@ -14,7 +14,6 @@ import java.util.List; import com.dfsek.terra.addons.biome.pipeline.api.BiomeHolder; import com.dfsek.terra.addons.biome.pipeline.api.stage.Stage; import com.dfsek.terra.addons.biome.pipeline.source.BiomeSource; -import com.dfsek.terra.api.util.vector.Vector2; public class BiomePipeline { @@ -22,12 +21,14 @@ public class BiomePipeline { private final List stages; private final int size; private final int init; + private final int resolution; - private BiomePipeline(BiomeSource source, List stages, int size, int init) { + private BiomePipeline(BiomeSource source, List stages, int size, int init, int resolution) { this.source = source; this.stages = stages; this.size = size; this.init = init; + this.resolution = resolution; } /** @@ -39,9 +40,13 @@ public class BiomePipeline { * @return BiomeHolder containing biomes. */ public BiomeHolder getBiomes(int x, int z, long seed) { - BiomeHolder holder = new BiomeHolderImpl(init, Vector2.of(x * (init - 1), z * (init - 1)).mutable()); - holder.fill(source, seed); - for(Stage stage : stages) holder = stage.apply(holder, seed); + x *= size; + z *= size; + BiomeHolder holder = new BiomeHolderImpl(init, size); + holder.fill(source, x, z, seed); + for(Stage stage : stages) { + holder = stage.apply(holder, x, z, seed); + } return holder; } @@ -61,10 +66,12 @@ public class BiomePipeline { private final int init; private final List stages = new ArrayList<>(); private int expand; + private final int resolution; - public BiomePipelineBuilder(int init) { + public BiomePipelineBuilder(int init, int resolution) { this.init = init; expand = init; + this.resolution = resolution; } public BiomePipeline build(BiomeSource source) { @@ -72,7 +79,7 @@ public class BiomePipeline { if(stage.isExpansion()) expand = expand * 2 - 1; } - return new BiomePipeline(source, stages, expand, init); + return new BiomePipeline(source, stages, expand, init, resolution); } public BiomePipelineBuilder addStage(Stage stage) { diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/BiomeHolder.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/BiomeHolder.java index 26bb63315..18b79602b 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/BiomeHolder.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/BiomeHolder.java @@ -14,11 +14,11 @@ import com.dfsek.terra.addons.biome.pipeline.source.BiomeSource; public interface BiomeHolder { - BiomeHolder expand(BiomeExpander expander, long seed); + BiomeHolder expand(BiomeExpander expander, int x, int z, long seed); - void mutate(BiomeMutator mutator, long seed); + void mutate(BiomeMutator mutator, int x, int z, long seed); - void fill(BiomeSource source, long seed); + void fill(BiomeSource source, int x, int z, long seed); BiomeDelegate getBiome(int x, int z); diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/stage/Stage.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/stage/Stage.java index fb4b1007b..965e5c3d2 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/stage/Stage.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/api/stage/Stage.java @@ -12,7 +12,7 @@ import com.dfsek.terra.addons.biome.pipeline.api.delegate.BiomeDelegate; public interface Stage { - BiomeHolder apply(BiomeHolder in, long seed); + BiomeHolder apply(BiomeHolder in, int x, int z, long seed); boolean isExpansion(); diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomePipelineTemplate.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomePipelineTemplate.java index e35d621e2..ebba18ead 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomePipelineTemplate.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/config/BiomePipelineTemplate.java @@ -46,7 +46,7 @@ public class BiomePipelineTemplate extends BiomeProviderTemplate { @Override public BiomeProvider get() { - BiomePipeline.BiomePipelineBuilder biomePipelineBuilder = new BiomePipeline.BiomePipelineBuilder(initialSize); + BiomePipeline.BiomePipelineBuilder biomePipelineBuilder = new BiomePipeline.BiomePipelineBuilder(initialSize, resolution); stages.forEach(biomePipelineBuilder::addStage); BiomePipeline pipeline = biomePipelineBuilder.build(source); return new BiomePipelineProvider(pipeline, resolution, blend, blendAmp); diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/stages/ExpanderStage.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/stages/ExpanderStage.java index e99c13e6b..ec8c3b0d8 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/stages/ExpanderStage.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/stages/ExpanderStage.java @@ -21,8 +21,8 @@ public class ExpanderStage implements Stage { } @Override - public BiomeHolder apply(BiomeHolder in, long seed) { - return in.expand(expander, seed); + public BiomeHolder apply(BiomeHolder in, int x, int z, long seed) { + return in.expand(expander, x, z, seed); } @Override diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/stages/MutatorStage.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/stages/MutatorStage.java index 8a9a06aae..d2b07816a 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/stages/MutatorStage.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/stages/MutatorStage.java @@ -21,8 +21,8 @@ public class MutatorStage implements Stage { } @Override - public BiomeHolder apply(BiomeHolder in, long seed) { - in.mutate(mutator, seed); + public BiomeHolder apply(BiomeHolder in, int x, int z, long seed) { + in.mutate(mutator, x, z, seed); return in; } From b83d4c21e07fa8e32354f61a8610080971ef0e35 Mon Sep 17 00:00:00 2001 From: dfsek Date: Sat, 16 Jul 2022 04:00:54 -0700 Subject: [PATCH 02/11] factor in resolution --- .../biome/pipeline/BiomeHolderImpl.java | 19 +++++++++++-------- .../addons/biome/pipeline/BiomePipeline.java | 2 +- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomeHolderImpl.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomeHolderImpl.java index 1910513a6..69c10d5b0 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomeHolderImpl.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomeHolderImpl.java @@ -20,22 +20,25 @@ public class BiomeHolderImpl implements BiomeHolder { private final double totalWidth; private final int originalWidth; private BiomeDelegate[][] biomes; + private final int resolution; - public BiomeHolderImpl(int width, double totalWidth) { + public BiomeHolderImpl(int width, double totalWidth, int resolution) { this.totalWidth = totalWidth; this.originalWidth = width; + this.resolution = resolution; width += 4; this.width = width; biomes = new BiomeDelegate[width][width]; this.offset = 2; } - private BiomeHolderImpl(BiomeDelegate[][] biomes, int width, int offset, double totalWidth, int originalWidth) { + private BiomeHolderImpl(BiomeDelegate[][] biomes, int width, int offset, double totalWidth, int originalWidth, int resolution) { this.biomes = biomes; this.width = width; this.offset = 2 * offset; this.totalWidth = totalWidth; this.originalWidth = originalWidth; + this.resolution = resolution; } private double normalise(double in) { @@ -54,18 +57,18 @@ public class BiomeHolderImpl implements BiomeHolder { for(int zi = 0; zi < width; zi++) { biomes[xi * 2][zi * 2] = old[xi][zi]; if(zi != width - 1) - biomes[xi * 2][zi * 2 + 1] = expander.getBetween(normalise(xi) + x, normalise(zi + 1) + z, seed, old[xi][zi], + biomes[xi * 2][zi * 2 + 1] = expander.getBetween((normalise(xi) + x) * resolution, (normalise(zi + 1) + z) * resolution, seed, old[xi][zi], old[xi][zi + 1]); if(xi != width - 1) - biomes[xi * 2 + 1][zi * 2] = expander.getBetween(normalise(xi + 1) + x, normalise(zi) + z, seed, old[xi][zi], + biomes[xi * 2 + 1][zi * 2] = expander.getBetween((normalise(xi + 1) + x) * resolution, (normalise(zi) + z) * resolution, seed, old[xi][zi], old[xi + 1][zi]); if(xi != width - 1 && zi != width - 1) - biomes[xi * 2 + 1][zi * 2 + 1] = expander.getBetween(normalise(xi + 1) + x, normalise(zi + 1) + z, seed, + biomes[xi * 2 + 1][zi * 2 + 1] = expander.getBetween((normalise(xi + 1) + x) * resolution, (normalise(zi + 1) + z) * resolution, seed, old[xi][zi], old[xi + 1][zi + 1], old[xi][zi + 1], old[xi + 1][zi]); } } - return new BiomeHolderImpl(biomes, newWidth, offset, totalWidth, originalWidth * 2 - 1); + return new BiomeHolderImpl(biomes, newWidth, offset, totalWidth, originalWidth * 2 - 1, resolution); } @Override @@ -73,7 +76,7 @@ public class BiomeHolderImpl implements BiomeHolder { for(int xi = 0; xi < width; xi++) { for(int zi = 0; zi < width; zi++) { BiomeMutator.ViewPoint viewPoint = new BiomeMutator.ViewPoint(this, xi, zi); - biomes[xi][zi] = mutator.mutate(viewPoint, normalise(xi) + x, normalise(zi) + z, seed); + biomes[xi][zi] = mutator.mutate(viewPoint, (normalise(xi) + x) * resolution, (normalise(zi) + z) * resolution, seed); } } } @@ -82,7 +85,7 @@ public class BiomeHolderImpl implements BiomeHolder { public void fill(BiomeSource source, int x, int z, long seed) { for(int xi = 0; xi < width; xi++) { for(int zi = 0; zi < width; zi++) { - biomes[xi][zi] = source.getBiome(normalise(xi) + x, normalise(zi) + z, seed); + biomes[xi][zi] = source.getBiome((normalise(xi) + x) * resolution, (normalise(zi) + z) * resolution, seed); } } } diff --git a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomePipeline.java b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomePipeline.java index 19dbb7896..44cee61b9 100644 --- a/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomePipeline.java +++ b/common/addons/biome-provider-pipeline/src/main/java/com/dfsek/terra/addons/biome/pipeline/BiomePipeline.java @@ -42,7 +42,7 @@ public class BiomePipeline { public BiomeHolder getBiomes(int x, int z, long seed) { x *= size; z *= size; - BiomeHolder holder = new BiomeHolderImpl(init, size); + BiomeHolder holder = new BiomeHolderImpl(init, size, resolution); holder.fill(source, x, z, seed); for(Stage stage : stages) { holder = stage.apply(holder, x, z, seed); From 5f5c4f85c74404998a2ba4d0c92b0aeb9f05ec10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sat, 16 Jul 2022 14:05:27 -0700 Subject: [PATCH 03/11] Fixes --- .../nms/v1_19_R1/config/FertilizableConfig.java | 7 +++++-- .../dfsek/terra/mod/config/FertilizableConfig.java | 11 +++++++---- .../terra/mod/mixin/gameplay/BoneMealTaskMixin.java | 6 ++++-- .../main/java/com/dfsek/terra/mod/util/BiomeUtil.java | 8 +++++++- .../com/dfsek/terra/mod/util/FertilizableUtil.java | 8 +++++--- 5 files changed, 28 insertions(+), 12 deletions(-) diff --git a/platforms/bukkit/nms/v1_19_R1/src/main/java/com/dfsek/terra/bukkit/nms/v1_19_R1/config/FertilizableConfig.java b/platforms/bukkit/nms/v1_19_R1/src/main/java/com/dfsek/terra/bukkit/nms/v1_19_R1/config/FertilizableConfig.java index 110f7d5ae..50641ad75 100644 --- a/platforms/bukkit/nms/v1_19_R1/src/main/java/com/dfsek/terra/bukkit/nms/v1_19_R1/config/FertilizableConfig.java +++ b/platforms/bukkit/nms/v1_19_R1/src/main/java/com/dfsek/terra/bukkit/nms/v1_19_R1/config/FertilizableConfig.java @@ -3,6 +3,9 @@ package com.dfsek.terra.bukkit.nms.v1_19_R1.config; import com.dfsek.tectonic.api.config.template.annotations.Default; import com.dfsek.tectonic.api.config.template.annotations.Value; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; + +import com.dfsek.terra.api.structure.Structure; + import net.minecraft.resources.ResourceLocation; import java.util.Map; @@ -14,7 +17,7 @@ import com.dfsek.terra.api.util.collection.ProbabilityCollection; public class FertilizableConfig implements ObjectTemplate { @Value("strucutres") @Default - private ProbabilityCollection structures = null; + private ProbabilityCollection structures = null; @Value("cooldowns") @Default @@ -28,7 +31,7 @@ public class FertilizableConfig implements ObjectTemplate { @Default private Boolean villagerFertilizable = null; - public ProbabilityCollection getStructures() { + public ProbabilityCollection getStructures() { return structures; } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/FertilizableConfig.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/FertilizableConfig.java index d1fe3f92d..aa8f495d2 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/FertilizableConfig.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/FertilizableConfig.java @@ -3,6 +3,9 @@ package com.dfsek.terra.mod.config; import com.dfsek.tectonic.api.config.template.annotations.Default; import com.dfsek.tectonic.api.config.template.annotations.Value; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; + +import com.dfsek.terra.api.structure.Structure; + import net.minecraft.util.Identifier; import java.util.Map; @@ -14,7 +17,7 @@ import com.dfsek.terra.api.util.collection.ProbabilityCollection; public class FertilizableConfig implements ObjectTemplate { @Value("strucutres") @Default - private ProbabilityCollection structures = null; + private ProbabilityCollection structures = null; @Value("cooldowns") @Default @@ -22,13 +25,13 @@ public class FertilizableConfig implements ObjectTemplate { @Value("can-grow") @Default - private ConfiguredStructure canGrow = null; + private Structure canGrow = null; @Value("villager-fertilizable") @Default private Boolean villagerFertilizable = null; - public ProbabilityCollection getStructures() { + public ProbabilityCollection getStructures() { return structures; } @@ -36,7 +39,7 @@ public class FertilizableConfig implements ObjectTemplate { return cooldowns; } - public ConfiguredStructure getCanGrow() { + public Structure getCanGrow() { return canGrow; } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java index 90e93b656..f21e424e0 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java @@ -1,6 +1,8 @@ package com.dfsek.terra.mod.mixin.gameplay; +import com.dfsek.terra.api.structure.Structure; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.ai.brain.task.BoneMealTask; @@ -38,10 +40,10 @@ public class BoneMealTaskMixin { Boolean villagerFertilizable = config.isVillagerFertilizable(); if(villagerFertilizable != null) { if(villagerFertilizable) { - ConfiguredStructure canGrow = config.getCanGrow(); + Structure canGrow = config.getCanGrow(); if(canGrow != null) { Random random = (Random) world.getRandom(); - cir.setReturnValue(canGrow.getStructure().get(random).generate( + cir.setReturnValue(canGrow.generate( Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE)); return; } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/BiomeUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/BiomeUtil.java index 4e13d6eec..ebc59e7cb 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/BiomeUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/BiomeUtil.java @@ -62,7 +62,13 @@ public class BiomeUtil { */ protected static void registerBiome(Biome biome, ConfigPack pack, com.dfsek.terra.api.registry.key.RegistryKey id) { - VanillaBiomeProperties vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class); + VanillaBiomeProperties vanillaBiomeProperties; + if (biome.getContext().has(VanillaBiomeProperties.class)) { + vanillaBiomeProperties = biome.getContext().get(VanillaBiomeProperties.class); + } else { + vanillaBiomeProperties = new VanillaBiomeProperties(); + } + net.minecraft.world.biome.Biome minecraftBiome = MinecraftUtil.createBiome(vanillaBiomeProperties); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java index 7ee320b75..d29af1232 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java @@ -1,5 +1,7 @@ package com.dfsek.terra.mod.util; +import com.dfsek.terra.api.structure.Structure; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.server.world.ServerWorld; @@ -31,9 +33,9 @@ public class FertilizableUtil { Block block = state.getBlock(); FertilizableConfig config = map.get(Registry.BLOCK.getId(block)); if(config != null) { - ConfiguredStructure canGrow = config.getCanGrow(); + Structure canGrow = config.getCanGrow(); if(canGrow != null) { - if(!canGrow.getStructure().get(random).generate( + if(!canGrow.generate( Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE)) { return false; } @@ -44,7 +46,7 @@ public class FertilizableUtil { return true; } } - config.getStructures().get(random).getStructure().get(random).generate( + config.getStructures().get(random).generate( Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE); return true; } From 6cd91bcc1df506baa30eb4d846d590eb99db618a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Fri, 19 Aug 2022 20:36:32 -0500 Subject: [PATCH 04/11] Random Changes --- .../structure/StructureCommandAddon.java | 14 ++++-- .../distributors/PaddedGridDistributor.java | 6 ++- .../addons/flora/flora/gen/TerraFlora.java | 9 ++-- .../locators/GaussianRandomLocator.java | 5 +- .../locator/locators/RandomLocator.java | 5 +- .../terra/addons/ore/ores/VanillaOre.java | 4 +- .../structure/structures/loot/Entry.java | 6 +-- .../structures/loot/LootTableImpl.java | 6 +-- .../structure/structures/loot/Pool.java | 8 ++-- .../loot/functions/AmountFunction.java | 6 +-- .../loot/functions/DamageFunction.java | 6 +-- .../loot/functions/EnchantFunction.java | 6 +-- .../loot/functions/LootFunction.java | 6 +-- .../feature/FeatureGenerationStage.java | 7 ++- .../shortcut/block/SingletonStructure.java | 4 +- .../structure/mutator/MutatedStructure.java | 4 +- .../terra/addons/sponge/SpongeStructure.java | 4 +- .../terrascript/script/StructureScript.java | 6 +-- .../script/TerraImplementationArguments.java | 8 ++-- .../script/functions/LootFunction.java | 8 ++-- .../dfsek/terra/api/structure/LootTable.java | 12 ++--- .../dfsek/terra/api/structure/Structure.java | 4 +- .../dfsek/terra/api/util/ConstantRange.java | 4 +- .../dfsek/terra/api/util/PopulationUtil.java | 12 +++-- .../java/com/dfsek/terra/api/util/Range.java | 4 +- .../collection/ProbabilityCollection.java | 6 +-- .../BukkitChunkGeneratorWrapper.java | 6 +-- .../mod/mixin/gameplay/BoneMealItemMixin.java | 6 ++- .../mod/mixin/gameplay/BoneMealTaskMixin.java | 8 ++-- .../mod/mixin/gameplay/ServerWorldMixin.java | 6 ++- .../terra/mod/util/FertilizableUtil.java | 15 ++---- .../terra/mod/util/MinecraftAdapter.java | 47 +++++++++++++++++++ 32 files changed, 161 insertions(+), 97 deletions(-) diff --git a/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java b/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java index f1d8d552c..dbafef915 100644 --- a/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java +++ b/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java @@ -6,8 +6,6 @@ import cloud.commandframework.arguments.standard.EnumArgument; import cloud.commandframework.arguments.standard.LongArgument; import cloud.commandframework.context.CommandContext; -import java.util.Random; - 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; @@ -27,6 +25,8 @@ import com.dfsek.terra.api.util.Rotation; import com.dfsek.terra.api.util.function.monad.Monad; import com.dfsek.terra.api.util.reflection.TypeKey; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; public class StructureCommandAddon implements MonadAddonInitializer { private static Registry getStructureRegistry(CommandContext sender) { @@ -57,9 +57,13 @@ public class StructureCommandAddon implements MonadAddonInitializer { structure.generate( sender.position().toInt(), sender.world(), - ((Long) context.get("seed") == 0) ? new Random() : new Random(context.get("seed")), - context.get("rotation") - ); + ((Long) context.get("seed") == 0) + ? RandomGeneratorFactory.of("Xoroshiro128PlusPlus") + .create() + : RandomGeneratorFactory.of("Xoroshiro128PlusPlus") + .create(context.get("seed")), + context.get("rotation") + ); }) .permission("terra.structures.generate") ); diff --git a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridDistributor.java b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridDistributor.java index bb380e034..444d2bc2f 100644 --- a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridDistributor.java +++ b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridDistributor.java @@ -2,7 +2,8 @@ package com.dfsek.terra.addons.feature.distributor.distributors; import net.jafama.FastMath; -import java.util.Random; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; import com.dfsek.terra.api.structure.feature.Distributor; import com.dfsek.terra.api.util.MathUtil; @@ -35,7 +36,8 @@ public class PaddedGridDistributor implements Distributor { int cellX = FastMath.floorDiv(x, cellWidth); int cellZ = FastMath.floorDiv(z, cellWidth); - Random random = new Random((murmur64(MathUtil.squash(cellX, cellZ)) ^ seed) + salt); + RandomGenerator random = RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create( + (murmur64(MathUtil.squash(cellX, cellZ)) ^ seed) + salt); int pointX = random.nextInt(width) + cellX * cellWidth; int pointZ = random.nextInt(width) + cellZ * cellWidth; diff --git a/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java b/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java index 31fbf1558..a28e2b05f 100644 --- a/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java +++ b/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java @@ -12,7 +12,8 @@ import net.jafama.FastMath; import java.util.ArrayList; import java.util.EnumSet; import java.util.List; -import java.util.Random; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; import com.dfsek.terra.api.block.state.BlockState; import com.dfsek.terra.api.block.state.properties.enums.Direction; @@ -73,7 +74,7 @@ public class TerraFlora 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) { boolean doRotation = testRotation.size() > 0; int size = layers.size(); int c = ceiling ? -1 : 1; @@ -88,7 +89,9 @@ public class TerraFlora implements Structure { location.getZ(), world.getSeed()); if(doRotation) { Direction oneFace = new ArrayList<>(faces).get( - new Random(location.getX() ^ location.getZ()).nextInt(faces.size())); // Get random face. + RandomGeneratorFactory.of("Xoroshiro128PlusPlus") + .create(location.getX() ^ location.getZ()) + .nextInt(faces.size())); // Get RandomGenerator face. } world.setBlockState(location.mutable().add(0, i + c, 0).immutable(), data, physics); } diff --git a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/GaussianRandomLocator.java b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/GaussianRandomLocator.java index 16fb827e5..471ef0cd5 100644 --- a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/GaussianRandomLocator.java +++ b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/GaussianRandomLocator.java @@ -7,7 +7,8 @@ package com.dfsek.terra.addons.feature.locator.locators; -import java.util.Random; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; import com.dfsek.terra.api.structure.feature.BinaryColumn; import com.dfsek.terra.api.structure.feature.Locator; @@ -40,7 +41,7 @@ public class GaussianRandomLocator implements Locator { seed = 31 * seed + column.getZ(); seed += salt; - Random r = new Random(seed); + RandomGenerator r = RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create(seed); int size = points.get(r); diff --git a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/RandomLocator.java b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/RandomLocator.java index fc86878ff..fb91e469a 100644 --- a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/RandomLocator.java +++ b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/RandomLocator.java @@ -7,7 +7,8 @@ package com.dfsek.terra.addons.feature.locator.locators; -import java.util.Random; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; import com.dfsek.terra.api.structure.feature.BinaryColumn; import com.dfsek.terra.api.structure.feature.Locator; @@ -36,7 +37,7 @@ public class RandomLocator implements Locator { seed = 31 * seed + column.getZ(); seed += salt; - Random r = new Random(seed); + RandomGenerator r = RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create(seed); int size = points.get(r); diff --git a/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java b/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java index a1046aea9..7f3a781d7 100644 --- a/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java +++ b/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java @@ -10,7 +10,7 @@ package com.dfsek.terra.addons.ore.ores; import net.jafama.FastMath; 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; @@ -42,7 +42,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) { int centerX = location.getX(); int centerZ = location.getZ(); int centerY = location.getY(); diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Entry.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Entry.java index ab8be10e2..4acfce6e6 100644 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Entry.java +++ b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Entry.java @@ -13,7 +13,7 @@ import org.json.simple.JSONObject; import java.util.ArrayList; import java.util.List; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.addons.structure.structures.loot.functions.AmountFunction; import com.dfsek.terra.addons.structure.structures.loot.functions.DamageFunction; @@ -86,11 +86,11 @@ public class Entry { /** * Fetches a single ItemStack from the Entry, applying all functions to it. * - * @param r The Random instance to apply functions with + * @param r The RandomGenerator instance to apply functions with * * @return ItemStack - The ItemStack with all functions applied. */ - public ItemStack getItem(Random r) { + public ItemStack getItem(RandomGenerator r) { ItemStack item = this.item.newItemStack(1); for(LootFunction f : functions) { item = f.apply(item, r); diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/LootTableImpl.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/LootTableImpl.java index c817c2d2d..6caeb9052 100644 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/LootTableImpl.java +++ b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/LootTableImpl.java @@ -14,7 +14,7 @@ import org.json.simple.parser.ParseException; import java.util.ArrayList; import java.util.List; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.Platform; import com.dfsek.terra.api.inventory.Inventory; @@ -44,7 +44,7 @@ public class LootTableImpl implements com.dfsek.terra.api.structure.LootTable { } @Override - public void fillInventory(Inventory i, Random r) { + public void fillInventory(Inventory i, RandomGenerator r) { List loot = getLoot(r); for(ItemStack stack : loot) { int attempts = 0; @@ -70,7 +70,7 @@ public class LootTableImpl implements com.dfsek.terra.api.structure.LootTable { } @Override - public List getLoot(Random r) { + public List getLoot(RandomGenerator r) { List itemList = new ArrayList<>(); for(Pool pool : pools) { itemList.addAll(pool.getItems(r)); diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Pool.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Pool.java index a807cb4a1..fa29a5090 100644 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Pool.java +++ b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Pool.java @@ -13,7 +13,7 @@ import org.json.simple.JSONObject; import java.util.ArrayList; import java.util.List; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.Platform; import com.dfsek.terra.api.inventory.ItemStack; @@ -51,13 +51,13 @@ public class Pool { } /** - * Fetches a list of items from the pool using the provided Random instance. + * Fetches a list of items from the pool using the provided RandomGenerator instance. * - * @param r The Random instance to use. + * @param r The RandomGenerator instance to use. * * @return List<ItemStack> - The list of items fetched. */ - public List getItems(Random r) { + public List getItems(RandomGenerator r) { int rolls = r.nextInt(max - min + 1) + min; List items = new ArrayList<>(); diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/AmountFunction.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/AmountFunction.java index 8fd59a5ee..8461dc623 100644 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/AmountFunction.java +++ b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/AmountFunction.java @@ -8,7 +8,7 @@ package com.dfsek.terra.addons.structure.structures.loot.functions; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.inventory.ItemStack; @@ -35,12 +35,12 @@ public class AmountFunction implements LootFunction { * Applies the function to an ItemStack. * * @param original The ItemStack on which to apply the function. - * @param r The Random instance to use. + * @param r The RandomGenerator instance to use. * * @return - ItemStack - The mutated ItemStack. */ @Override - public ItemStack apply(ItemStack original, Random r) { + public ItemStack apply(ItemStack original, RandomGenerator r) { original.setAmount(r.nextInt(max - min + 1) + min); return original; } diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/DamageFunction.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/DamageFunction.java index 09eda7417..cd9664770 100644 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/DamageFunction.java +++ b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/DamageFunction.java @@ -7,7 +7,7 @@ package com.dfsek.terra.addons.structure.structures.loot.functions; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.inventory.ItemStack; import com.dfsek.terra.api.inventory.item.Damageable; @@ -36,12 +36,12 @@ public class DamageFunction implements LootFunction { * Applies the function to an ItemStack. * * @param original The ItemStack on which to apply the function. - * @param r The Random instance to use. + * @param r The RandomGenerator instance to use. * * @return - ItemStack - The mutated ItemStack. */ @Override - public ItemStack apply(ItemStack original, Random r) { + public ItemStack apply(ItemStack original, RandomGenerator r) { if(original == null) return null; if(!original.isDamageable()) return original; ItemMeta meta = original.getItemMeta(); diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/EnchantFunction.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/EnchantFunction.java index 6f5b4d62d..4e54941ba 100644 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/EnchantFunction.java +++ b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/EnchantFunction.java @@ -15,7 +15,7 @@ import org.slf4j.LoggerFactory; import java.util.ArrayList; import java.util.Collections; import java.util.List; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.Platform; import com.dfsek.terra.api.inventory.ItemStack; @@ -42,12 +42,12 @@ public class EnchantFunction implements LootFunction { * Applies the function to an ItemStack. * * @param original The ItemStack on which to apply the function. - * @param r The Random instance to use. + * @param r The RandomGenerator instance to use. * * @return - ItemStack - The mutated ItemStack. */ @Override - public ItemStack apply(ItemStack original, Random r) { + public ItemStack apply(ItemStack original, RandomGenerator r) { if(original.getItemMeta() == null) return original; double enchant = (r.nextDouble() * (max - min)) + min; diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/LootFunction.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/LootFunction.java index ebe0fd550..adce098a7 100644 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/LootFunction.java +++ b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/LootFunction.java @@ -8,7 +8,7 @@ package com.dfsek.terra.addons.structure.structures.loot.functions; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.inventory.ItemStack; @@ -21,9 +21,9 @@ public interface LootFunction { * Applies the function to an ItemStack. * * @param original The ItemStack on which to apply the function. - * @param r The Random instance to use. + * @param r The RandomGenerator instance to use. * * @return - ItemStack - The mutated ItemStack. */ - ItemStack apply(ItemStack original, Random r); + ItemStack apply(ItemStack original, RandomGenerator r); } diff --git a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java index 5408b26e4..150e381d4 100644 --- a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java +++ b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java @@ -8,7 +8,8 @@ package com.dfsek.terra.addons.generation.feature; import java.util.Collections; -import java.util.Random; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; import com.dfsek.terra.addons.generation.feature.config.BiomeFeatures; import com.dfsek.terra.api.Platform; @@ -72,7 +73,9 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab .forEach(y -> feature.getStructure(world, x, y, z) .generate(Vector3Int.of(x, y, z), world, - new Random(coordinateSeed * 31 + y), + RandomGeneratorFactory.of( + "Xoroshiro128PlusPlus") + .create(coordinateSeed * 31 + y), Rotation.NONE) ); } diff --git a/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java b/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java index 7d14c6ee7..d7fba683f 100644 --- a/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java +++ b/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java @@ -1,6 +1,6 @@ package com.dfsek.terra.addons.palette.shortcut.block; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.block.state.BlockState; import com.dfsek.terra.api.structure.Structure; @@ -17,7 +17,7 @@ public class SingletonStructure 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) { world.setBlockState(location, blockState); return true; } diff --git a/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java b/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java index a5aafdd1e..8ff16d9db 100644 --- a/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java +++ b/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java @@ -1,6 +1,6 @@ package com.dfsek.terra.addons.structure.mutator; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.registry.key.Keyed; import com.dfsek.terra.api.registry.key.RegistryKey; @@ -32,7 +32,7 @@ public class MutatedStructure implements Structure, Keyed { } @Override - public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { return base.generate(location, world .buffer() diff --git a/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java b/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java index e08c51146..1e3cf7f0c 100644 --- a/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java +++ b/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java @@ -7,7 +7,7 @@ package com.dfsek.terra.addons.sponge; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.block.state.BlockState; import com.dfsek.terra.api.registry.key.Keyed; @@ -31,7 +31,7 @@ public class SpongeStructure implements Structure, Keyed { } @Override - public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { int bX = location.getX(); int bY = location.getY(); int bZ = location.getZ(); diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java index e865d0d6d..9a9d040ff 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java @@ -15,7 +15,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.io.InputStream; import java.nio.charset.Charset; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.addons.terrascript.parser.Parser; import com.dfsek.terra.addons.terrascript.parser.lang.Executable; @@ -130,14 +130,14 @@ public class StructureScript implements Structure, Keyed { @Override @SuppressWarnings("try") - public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { platform.getProfiler().push(profile); boolean result = applyBlock(new TerraImplementationArguments(location, rotation, random, world, 0)); platform.getProfiler().pop(profile); return result; } - public boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation, int recursions) { + public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation, int recursions) { platform.getProfiler().push(profile); boolean result = applyBlock(new TerraImplementationArguments(location, rotation, random, world, recursions)); platform.getProfiler().pop(profile); diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/TerraImplementationArguments.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/TerraImplementationArguments.java index b9b9af058..d768b30ec 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/TerraImplementationArguments.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/TerraImplementationArguments.java @@ -9,7 +9,7 @@ package com.dfsek.terra.addons.terrascript.script; import java.util.HashMap; import java.util.Map; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments; import com.dfsek.terra.api.util.Rotation; @@ -20,14 +20,14 @@ import com.dfsek.terra.api.world.WritableWorld; public class TerraImplementationArguments implements ImplementationArguments { private final Rotation rotation; - private final Random random; + private final RandomGenerator random; private final WritableWorld world; private final Map marks = new HashMap<>(); private final int recursions; private final Vector3Int origin; private boolean waterlog = false; - public TerraImplementationArguments(Vector3Int origin, Rotation rotation, Random random, WritableWorld world, int recursions) { + public TerraImplementationArguments(Vector3Int origin, Rotation rotation, RandomGenerator random, WritableWorld world, int recursions) { this.rotation = rotation; this.random = random; this.world = world; @@ -39,7 +39,7 @@ public class TerraImplementationArguments implements ImplementationArguments { return recursions; } - public Random getRandom() { + public RandomGenerator getRandom() { return random; } diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/LootFunction.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/LootFunction.java index ebadb9288..a58ee67d5 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/LootFunction.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/LootFunction.java @@ -11,8 +11,6 @@ import net.jafama.FastMath; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import java.util.Random; - import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments; import com.dfsek.terra.addons.terrascript.parser.lang.Returnable; import com.dfsek.terra.addons.terrascript.parser.lang.Scope; @@ -31,6 +29,9 @@ import com.dfsek.terra.api.util.RotationUtil; import com.dfsek.terra.api.util.vector.Vector2; import com.dfsek.terra.api.util.vector.Vector3; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; + public class LootFunction implements Function { private static final Logger LOGGER = LoggerFactory.getLogger(LootFunction.class); @@ -85,7 +86,8 @@ public class LootFunction implements Function { if(event.isCancelled()) return; event.getTable().fillInventory(container.getInventory(), - new Random(apply.hashCode())); + RandomGeneratorFactory.of( + "Xoroshiro128PlusPlus").create(apply.hashCode())); data.update(false); } catch(Exception e) { LOGGER.error("Could not apply loot at {}", apply, e); diff --git a/common/api/src/main/java/com/dfsek/terra/api/structure/LootTable.java b/common/api/src/main/java/com/dfsek/terra/api/structure/LootTable.java index 162247c82..64f1f250e 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/structure/LootTable.java +++ b/common/api/src/main/java/com/dfsek/terra/api/structure/LootTable.java @@ -10,7 +10,7 @@ package com.dfsek.terra.api.structure; import org.jetbrains.annotations.ApiStatus.Experimental; import java.util.List; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.inventory.Inventory; import com.dfsek.terra.api.inventory.ItemStack; @@ -22,16 +22,16 @@ public interface LootTable { * Fills an Inventory with loot. * * @param i The Inventory to fill. - * @param r The The Random instance to use. + * @param r The The RandomGenerator instance to use. */ - void fillInventory(Inventory i, Random r); + void fillInventory(Inventory i, RandomGenerator r); /** - * Fetches a list of ItemStacks from the loot table using the given Random instance. + * Fetches a list of ItemStacks from the loot table using the given RandomGenerator instance. * - * @param r The Random instance to use. + * @param r The RandomGenerator instance to use. * * @return List<ItemStack> - The list of loot fetched. */ - List getLoot(Random r); + List getLoot(RandomGenerator r); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java b/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java index 479c77e38..20aa70d1d 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java +++ b/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java @@ -7,7 +7,7 @@ package com.dfsek.terra.api.structure; -import java.util.Random; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.util.Rotation; import com.dfsek.terra.api.util.vector.Vector3Int; @@ -15,5 +15,5 @@ import com.dfsek.terra.api.world.WritableWorld; public interface Structure { - boolean generate(Vector3Int location, WritableWorld world, Random random, Rotation rotation); + boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/ConstantRange.java b/common/api/src/main/java/com/dfsek/terra/api/util/ConstantRange.java index 5849d09a6..cb8bc8278 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/ConstantRange.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/ConstantRange.java @@ -11,7 +11,7 @@ import net.jafama.FastMath; import org.jetbrains.annotations.NotNull; import java.util.Iterator; -import java.util.Random; +import java.util.random.RandomGenerator; public class ConstantRange implements Range { @@ -37,7 +37,7 @@ public class ConstantRange implements Range { } @Override - public int get(Random r) { + public int get(RandomGenerator r) { return r.nextInt(min, max); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/PopulationUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/PopulationUtil.java index d8949a0c2..6360bc028 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/PopulationUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/PopulationUtil.java @@ -7,18 +7,20 @@ package com.dfsek.terra.api.util; -import java.util.Random; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; import com.dfsek.terra.api.world.chunk.Chunk; public final class PopulationUtil { - public static Random getRandom(Chunk c) { + public static RandomGenerator getRandom(Chunk c) { return getRandom(c, 0); } - public static Random getRandom(Chunk c, long salt) { - return new Random(getCarverChunkSeed(c.getX(), c.getZ(), c.getWorld().getSeed() + salt)); + public static RandomGenerator getRandom(Chunk c, long salt) { + return RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create( + getCarverChunkSeed(c.getX(), c.getZ(), c.getWorld().getSeed() + salt)); } /** @@ -31,7 +33,7 @@ public final class PopulationUtil { * @return long - The carver seed. */ public static long getCarverChunkSeed(int chunkX, int chunkZ, long seed) { - Random r = new Random(seed); + RandomGenerator r = RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create(seed); return chunkX * r.nextLong() ^ chunkZ * r.nextLong() ^ seed; } } diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/Range.java b/common/api/src/main/java/com/dfsek/terra/api/util/Range.java index c417b8183..df7c46d28 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/Range.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/Range.java @@ -10,8 +10,8 @@ package com.dfsek.terra.api.util; import org.jetbrains.annotations.NotNull; import java.util.Iterator; -import java.util.Random; import java.util.function.Supplier; +import java.util.random.RandomGenerator; public interface Range extends Iterable { @@ -19,7 +19,7 @@ public interface Range extends Iterable { Range reflect(int pt); - int get(Random r); + int get(RandomGenerator r); Range intersects(Range other); diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/collection/ProbabilityCollection.java b/common/api/src/main/java/com/dfsek/terra/api/util/collection/ProbabilityCollection.java index f5d5863c6..4302fa50f 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/collection/ProbabilityCollection.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/collection/ProbabilityCollection.java @@ -15,9 +15,9 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map; -import java.util.Random; import java.util.Set; import java.util.function.Function; +import java.util.random.RandomGenerator; import com.dfsek.terra.api.noise.NoiseSampler; import com.dfsek.terra.api.util.MathUtil; @@ -43,7 +43,7 @@ public class ProbabilityCollection implements Collection { } @SuppressWarnings("unchecked") - public E get(Random r) { + public E get(RandomGenerator r) { if(array.length == 0) return null; return (E) array[r.nextInt(array.length)]; } @@ -195,7 +195,7 @@ public class ProbabilityCollection implements Collection { } @Override - public T get(Random r) { + public T get(RandomGenerator r) { return single; } diff --git a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/generator/BukkitChunkGeneratorWrapper.java b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/generator/BukkitChunkGeneratorWrapper.java index 4cb9bfaef..9df6f7f15 100644 --- a/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/generator/BukkitChunkGeneratorWrapper.java +++ b/platforms/bukkit/common/src/main/java/com/dfsek/terra/bukkit/generator/BukkitChunkGeneratorWrapper.java @@ -28,7 +28,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; import java.util.List; -import java.util.Random; +import java.util.random.RandomGenerator; import java.util.stream.Collectors; import com.dfsek.terra.api.block.state.BlockState; @@ -63,7 +63,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener } @Override - public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z, @NotNull ChunkData chunkData) { + public void generateNoise(@NotNull WorldInfo worldInfo, @NotNull RandomGenerator random, int x, int z, @NotNull ChunkData chunkData) { BukkitWorldProperties properties = new BukkitWorldProperties(worldInfo); delegate.generateChunkData(new BukkitProtoChunk(chunkData), properties, pack.getBiomeProvider(), x, z); } @@ -74,7 +74,7 @@ public class BukkitChunkGeneratorWrapper extends org.bukkit.generator.ChunkGener .stream() .map(generationStage -> new BlockPopulator() { @Override - public void populate(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z, + public void populate(@NotNull WorldInfo worldInfo, @NotNull RandomGenerator random, int x, int z, @NotNull LimitedRegion limitedRegion) { generationStage.populate(new BukkitProtoWorld(limitedRegion, air, pack.getBiomeProvider())); } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealItemMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealItemMixin.java index 22fac5a71..96c69f8a8 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealItemMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealItemMixin.java @@ -1,6 +1,8 @@ package com.dfsek.terra.mod.mixin.gameplay; +import com.dfsek.terra.mod.util.MinecraftAdapter; + import net.minecraft.item.BoneMealItem; import net.minecraft.item.ItemStack; import net.minecraft.server.world.ServerWorld; @@ -14,6 +16,8 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import com.dfsek.terra.mod.util.FertilizableUtil; +import java.util.random.RandomGenerator; + @Mixin(BoneMealItem.class) public class BoneMealItemMixin { @@ -22,7 +26,7 @@ public class BoneMealItemMixin { @Inject(method = "useOnFertilizable", at = @At("HEAD"), cancellable = true) private static void injectUseOnFertilizable(ItemStack stack, World world, BlockPos pos, CallbackInfoReturnable cir) { if(world instanceof ServerWorld) { - Boolean value = FertilizableUtil.grow((ServerWorld) world, pos, world.getBlockState(pos), cooldownId); + Boolean value = FertilizableUtil.grow((ServerWorld) world, MinecraftAdapter.adapt(world.getRandom()), pos, world.getBlockState(pos), cooldownId); stack.decrement(1); if(value != null) { cir.setReturnValue(value); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java index f21e424e0..3eb8d813b 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java @@ -1,7 +1,7 @@ package com.dfsek.terra.mod.mixin.gameplay; -import com.dfsek.terra.api.structure.Structure; +import com.dfsek.terra.mod.util.MinecraftAdapter; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -16,9 +16,9 @@ import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import java.util.Map; -import java.util.Random; +import java.util.random.RandomGenerator; -import com.dfsek.terra.api.structure.configured.ConfiguredStructure; +import com.dfsek.terra.api.structure.Structure; import com.dfsek.terra.api.util.Rotation; import com.dfsek.terra.api.util.vector.Vector3Int; import com.dfsek.terra.api.world.WritableWorld; @@ -42,7 +42,7 @@ public class BoneMealTaskMixin { if(villagerFertilizable) { Structure canGrow = config.getCanGrow(); if(canGrow != null) { - Random random = (Random) world.getRandom(); + RandomGenerator random = MinecraftAdapter.adapt(world.getRandom()); cir.setReturnValue(canGrow.generate( Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE)); return; diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/ServerWorldMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/ServerWorldMixin.java index 0081db33d..b64726b36 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/ServerWorldMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/ServerWorldMixin.java @@ -1,6 +1,8 @@ package com.dfsek.terra.mod.mixin.gameplay; +import com.dfsek.terra.mod.util.MinecraftAdapter; + import net.minecraft.block.BlockState; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.Identifier; @@ -12,6 +14,8 @@ import org.spongepowered.asm.mixin.injection.Redirect; import com.dfsek.terra.mod.util.FertilizableUtil; +import java.util.random.RandomGenerator; + @Mixin(ServerWorld.class) public class ServerWorldMixin { @@ -22,7 +26,7 @@ public class ServerWorldMixin { target = "Lnet/minecraft/block/BlockState;randomTick(Lnet/minecraft/server/world/ServerWorld;" + "Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/random/Random;)V")) public void injectTickChunk(BlockState instance, ServerWorld serverWorld, BlockPos blockPos, Random random) { - Boolean value = FertilizableUtil.grow(serverWorld, blockPos, instance, cooldownId); + Boolean value = FertilizableUtil.grow(serverWorld, MinecraftAdapter.adapt(random), blockPos, instance, cooldownId); if(value != null) { if(!value) { instance.randomTick(serverWorld, blockPos, random); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java index d29af1232..a550660ca 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java @@ -1,7 +1,5 @@ package com.dfsek.terra.mod.util; -import com.dfsek.terra.api.structure.Structure; - import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.server.world.ServerWorld; @@ -10,9 +8,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.registry.Registry; import java.util.Map; -import java.util.Random; +import java.util.random.RandomGenerator; -import com.dfsek.terra.api.structure.configured.ConfiguredStructure; +import com.dfsek.terra.api.structure.Structure; import com.dfsek.terra.api.util.Rotation; import com.dfsek.terra.api.util.vector.Vector3Int; import com.dfsek.terra.api.world.WritableWorld; @@ -20,14 +18,7 @@ import com.dfsek.terra.mod.config.FertilizableConfig; public class FertilizableUtil { - - private static final Random mojankRandom = new Random(); - - public static Boolean grow(ServerWorld world, BlockPos pos, BlockState state, Identifier cooldownId) { - return grow(world, mojankRandom, pos, state, cooldownId); - } - - public static Boolean grow(ServerWorld world, Random random, BlockPos pos, BlockState state, Identifier cooldownId) { + public static Boolean grow(ServerWorld world, RandomGenerator random, BlockPos pos, BlockState state, Identifier cooldownId) { Map map = BiomeUtil.TERRA_BIOME_FERTILIZABLE_MAP.get(world.getBiome(pos)); if(map != null) { Block block = state.getBlock(); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/MinecraftAdapter.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/MinecraftAdapter.java index 2f43913e2..f21f40505 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/MinecraftAdapter.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/MinecraftAdapter.java @@ -18,11 +18,14 @@ package com.dfsek.terra.mod.util; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.random.Random; import net.minecraft.world.HeightLimitView; import com.dfsek.terra.api.util.vector.Vector3; import com.dfsek.terra.api.world.info.WorldProperties; +import java.util.random.RandomGenerator; + public final class MinecraftAdapter { @@ -53,4 +56,48 @@ public final class MinecraftAdapter { } }; } + + public static RandomGenerator adapt(Random random) { + return new RandomGenerator() { + @Override + public boolean nextBoolean() { + return random.nextBoolean(); + } + + @Override + public float nextFloat() { + return random.nextFloat(); + } + + @Override + public double nextDouble() { + return random.nextDouble(); + } + + @Override + public int nextInt() { + return random.nextInt(); + } + + @Override + public int nextInt(int bound) { + return random.nextInt(bound); + } + + @Override + public long nextLong() { + return random.nextLong(); + } + + @Override + public double nextGaussian() { + return random.nextGaussian(); + } + + @Override + public int nextInt(int origin, int bound) { + return random.nextBetween(origin, bound); + } + }; + } } From 2d97c776fcad89c3e08377d955da68da18427057 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Mon, 18 Jul 2022 20:44:07 -0700 Subject: [PATCH 05/11] Dim opts --- .../com/dfsek/terra/mod/MinecraftAddon.java | 16 ++ .../terra/mod/config/FertilizableConfig.java | 13 +- .../mod/config/MonsterSettingsTemplate.java | 38 +++++ .../mod/config/VanillaWorldProperties.java | 141 ++++++++++++++++++ .../java/com/dfsek/terra/mod/data/Codecs.java | 10 ++ .../MinecraftChunkGeneratorWrapper.java | 24 ++- .../mod/implmentation/TerraIntProvider.java | 43 ++++++ .../mod/mixin/gameplay/BoneMealTaskMixin.java | 9 +- .../lifecycle/DataPackContentsMixin.java | 2 + .../dfsek/terra/mod/util/DimensionUtil.java | 62 ++++++++ .../dfsek/terra/mod/util/MinecraftUtil.java | 15 ++ .../com/dfsek/terra/mod/util/PresetUtil.java | 20 ++- .../terra/lifecycle/util/RegistryUtil.java | 3 + 13 files changed, 378 insertions(+), 18 deletions(-) create mode 100644 platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/MonsterSettingsTemplate.java create mode 100644 platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/VanillaWorldProperties.java create mode 100644 platforms/mixin-common/src/main/java/com/dfsek/terra/mod/implmentation/TerraIntProvider.java create mode 100644 platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/DimensionUtil.java diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/MinecraftAddon.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/MinecraftAddon.java index fa1214389..e41141f1f 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/MinecraftAddon.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/MinecraftAddon.java @@ -19,6 +19,13 @@ package com.dfsek.terra.mod; import ca.solostudios.strata.Versions; import ca.solostudios.strata.version.Version; + +import com.dfsek.terra.api.config.ConfigPack; + +import com.dfsek.terra.mod.config.VanillaWorldProperties; + +import com.dfsek.terra.mod.util.MinecraftUtil; + import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -44,6 +51,15 @@ public abstract class MinecraftAddon implements BaseAddon { @Override public void initialize() { + modPlatform.getEventManager() + .getHandler(FunctionalEventHandler.class) + .register(this, ConfigurationLoadEvent.class) + .then(event -> { + if(event.is(ConfigPack.class)) { + event.getLoadedObject(ConfigPack.class).getContext().put(event.load(new VanillaWorldProperties())); + } + }) + .global(); modPlatform.getEventManager() .getHandler(FunctionalEventHandler.class) .register(this, ConfigPackPreLoadEvent.class) diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/FertilizableConfig.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/FertilizableConfig.java index aa8f495d2..b16c39e93 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/FertilizableConfig.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/FertilizableConfig.java @@ -3,14 +3,11 @@ package com.dfsek.terra.mod.config; import com.dfsek.tectonic.api.config.template.annotations.Default; import com.dfsek.tectonic.api.config.template.annotations.Value; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; - -import com.dfsek.terra.api.structure.Structure; - import net.minecraft.util.Identifier; import java.util.Map; -import com.dfsek.terra.api.structure.configured.ConfiguredStructure; +import com.dfsek.terra.api.structure.Structure; import com.dfsek.terra.api.util.collection.ProbabilityCollection; @@ -27,9 +24,9 @@ public class FertilizableConfig implements ObjectTemplate { @Default private Structure canGrow = null; - @Value("villager-fertilizable") + @Value("villager-farmable") @Default - private Boolean villagerFertilizable = null; + private Boolean villagerFarmable = null; public ProbabilityCollection getStructures() { return structures; @@ -43,8 +40,8 @@ public class FertilizableConfig implements ObjectTemplate { return canGrow; } - public Boolean isVillagerFertilizable() { - return villagerFertilizable; + public Boolean isVillagerFarmable() { + return villagerFarmable; } @Override diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/MonsterSettingsTemplate.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/MonsterSettingsTemplate.java new file mode 100644 index 000000000..e585fe43a --- /dev/null +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/MonsterSettingsTemplate.java @@ -0,0 +1,38 @@ +package com.dfsek.terra.mod.config; + +import com.dfsek.tectonic.api.config.template.annotations.Default; +import com.dfsek.tectonic.api.config.template.annotations.Value; + +import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; + +import com.dfsek.terra.api.util.ConstantRange; +import com.dfsek.terra.api.util.Range; + +import com.dfsek.terra.mod.implmentation.TerraIntProvider; + +import net.minecraft.world.dimension.DimensionType.MonsterSettings; + + +public class MonsterSettingsTemplate implements ObjectTemplate { + @Value("piglin-safe") + @Default + private Boolean piglinSafe = false; + + @Value("has-raids") + @Default + private Boolean hasRaids = false; + + @Value("monster-spawn-light") + @Default + private Range monsterSpawnLight = new ConstantRange(0, 1); + + @Value("monster-spawn-block-light-limit") + @Default + private int monsterSpawnBlockLightLimit = 0; + + + @Override + public MonsterSettings get() { + return new MonsterSettings(piglinSafe, hasRaids, new TerraIntProvider(monsterSpawnLight), monsterSpawnBlockLightLimit); + } +} diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/VanillaWorldProperties.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/VanillaWorldProperties.java new file mode 100644 index 000000000..8ee95432b --- /dev/null +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/config/VanillaWorldProperties.java @@ -0,0 +1,141 @@ +package com.dfsek.terra.mod.config; + +import com.dfsek.tectonic.api.config.template.ConfigTemplate; +import com.dfsek.tectonic.api.config.template.annotations.Default; +import com.dfsek.tectonic.api.config.template.annotations.Value; + +import com.dfsek.terra.mod.implmentation.TerraIntProvider; + +import net.minecraft.client.gl.Uniform; +import net.minecraft.util.Identifier; +import net.minecraft.util.math.intprovider.IntProvider; +import net.minecraft.util.math.intprovider.IntProviderType; +import net.minecraft.util.math.random.Random; +import net.minecraft.world.dimension.DimensionType.MonsterSettings; + +import com.dfsek.terra.api.properties.Properties; +import com.dfsek.terra.api.util.ConstantRange; +import com.dfsek.terra.api.util.Range; + + +public class VanillaWorldProperties implements ConfigTemplate, Properties { + @Value("minecraft.fixed-time") + @Default + private Long fixedTime = null; + + @Value("minecraft.has-sky-light") + @Default + private Boolean hasSkyLight = false; + + @Value("minecraft.has-ceiling") + @Default + private Boolean hasCeiling = false; + + @Value("minecraft.ultra-warm") + @Default + private Boolean ultraWarm = false; + + @Value("minecraft.natural") + @Default + private Boolean natural = false; + + @Value("minecraft.coordinate-scale") + @Default + private Double coordinateScale = 1.0E-5d; + + @Value("minecraft.bed-works") + @Default + private Boolean bedWorks = false; + + @Value("minecraft.respawn-anchor-works") + @Default + private Boolean respawnAnchorWorks = false; + + @Value("minecraft.height") + @Default + private Range height = new ConstantRange(0, 16); + + @Value("minecraft.height.logical") + @Default + private Integer logicalHeight = 0; + + @Value("minecraft.infiniburn") + @Default + private Identifier infiniburn = new Identifier(""); + + @Value("minecraft.effects") + @Default + private Identifier effects = new Identifier(""); + + @Value("minecraft.ambient-light") + @Default + private Float ambientLight = Float.MAX_VALUE; + + @Value("minecraft.monster-settings") + @Default + private MonsterSettings monsterSettings = new MonsterSettings(false, false, new TerraIntProvider(new ConstantRange(0, 1)), 0); + + @Value("minecraft.sealevel") + @Default + private Integer sealevel = 0; + + public Long getFixedTime() { + return fixedTime; + } + + public Boolean getHasSkyLight() { + return hasSkyLight; + } + + public Boolean getHasCeiling() { + return hasCeiling; + } + + public Boolean getUltraWarm() { + return ultraWarm; + } + + public Boolean getNatural() { + return natural; + } + + public Double getCoordinateScale() { + return coordinateScale; + } + + public Boolean getBedWorks() { + return bedWorks; + } + + public Boolean getRespawnAnchorWorks() { + return respawnAnchorWorks; + } + + public Range getHeight() { + return height; + } + + public Integer getLogicalHeight() { + return logicalHeight; + } + + public Identifier getInfiniburn() { + return infiniburn; + } + + public Identifier getEffects() { + return effects; + } + + public Float getAmbientLight() { + return ambientLight; + } + + public MonsterSettings getMonsterSettings() { + return monsterSettings; + } + + public Integer getSealevel() { + return sealevel; + } +} diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/data/Codecs.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/data/Codecs.java index 5f5dd615a..66e668cbf 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/data/Codecs.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/data/Codecs.java @@ -1,5 +1,10 @@ package com.dfsek.terra.mod.data; +import com.dfsek.terra.api.util.ConstantRange; +import com.dfsek.terra.api.util.Range; + +import com.dfsek.terra.mod.implmentation.TerraIntProvider; + import com.mojang.serialization.Codec; import com.mojang.serialization.codecs.RecordCodecBuilder; import net.minecraft.util.dynamic.RegistryOps; @@ -62,4 +67,9 @@ public final class Codecs { .forGetter(MinecraftChunkGeneratorWrapper::getSettings) ).apply(instance, instance.stable(MinecraftChunkGeneratorWrapper::new)) ); + + public static final Codec TERRA_CONSTANT_RANGE_INT_PROVIDER_TYPE = RecordCodecBuilder.create(range -> range.group( + Codec.INT.fieldOf("min").stable().forGetter(TerraIntProvider::getMin), + Codec.INT.fieldOf("max").stable().forGetter(TerraIntProvider::getMax)).apply(range, range.stable((min, max) -> new TerraIntProvider(new ConstantRange( + min, max))))); } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java index 5742120d6..03a7c8f6f 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java @@ -17,6 +17,9 @@ package com.dfsek.terra.mod.generation; +import com.dfsek.terra.mod.config.VanillaBiomeProperties; +import com.dfsek.terra.mod.config.VanillaWorldProperties; + import com.mojang.serialization.Codec; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -76,6 +79,8 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun private ChunkGenerator delegate; private ConfigPack pack; + private VanillaWorldProperties vanillaWorldProperties; + public MinecraftChunkGeneratorWrapper(Registry noiseRegistry, TerraBiomeSource biomeSource, ConfigPack configPack, RegistryEntry settingsSupplier) { super(noiseRegistry, Optional.empty(), biomeSource); @@ -86,6 +91,11 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun this.delegate = pack.getGeneratorProvider().newInstance(pack); logger.info("Loading world with config pack {}", pack.getID()); this.biomeSource = biomeSource; + if (pack.getContext().has(VanillaBiomeProperties.class)) { + vanillaWorldProperties = pack.getContext().get(VanillaWorldProperties.class); + } else { + vanillaWorldProperties = new VanillaWorldProperties(); + } } public Registry getNoiseRegistry() { @@ -115,7 +125,7 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun @Override public int getWorldHeight() { - return settings.value().generationShapeConfig().height(); + return vanillaWorldProperties.getHeight().getMax(); } @@ -174,12 +184,12 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun @Override public int getSeaLevel() { - return settings.value().seaLevel(); + return vanillaWorldProperties.getSealevel(); } @Override public int getMinimumY() { - return settings.value().generationShapeConfig().minimumY(); + return vanillaWorldProperties.getHeight().getMin(); } @@ -209,7 +219,7 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun @Override public void getDebugHudText(List text, NoiseConfig noiseConfig, BlockPos pos) { - + // no op } public ConfigPack getPack() { @@ -220,6 +230,12 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun this.pack = pack; this.delegate = pack.getGeneratorProvider().newInstance(pack); biomeSource.setPack(pack); + + if (pack.getContext().has(VanillaBiomeProperties.class)) { + vanillaWorldProperties = pack.getContext().get(VanillaWorldProperties.class); + } else { + vanillaWorldProperties = new VanillaWorldProperties(); + } logger.debug("Loading world with config pack {}", pack.getID()); } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/implmentation/TerraIntProvider.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/implmentation/TerraIntProvider.java new file mode 100644 index 000000000..dd5d51687 --- /dev/null +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/implmentation/TerraIntProvider.java @@ -0,0 +1,43 @@ +package com.dfsek.terra.mod.implmentation; + +import com.dfsek.terra.api.util.Range; + +import com.dfsek.terra.mod.util.MinecraftAdapter; + +import net.minecraft.util.math.intprovider.IntProvider; +import net.minecraft.util.math.intprovider.IntProviderType; +import net.minecraft.util.math.random.Random; + +import java.util.HashMap; +import java.util.Map; + + +public class TerraIntProvider extends IntProvider { + public static final Map TERRA_RANGE_TYPE_TO_INT_PROVIDER_TYPE = new HashMap<>(); + + public Range delegate; + + public TerraIntProvider(Range delegate) { + this.delegate = delegate; + } + + @Override + public int get(Random random) { + return delegate.get(MinecraftAdapter.adapt(random)); + } + + @Override + public int getMin() { + return delegate.getMin(); + } + + @Override + public int getMax() { + return delegate.getMax(); + } + + @Override + public IntProviderType getType() { + return TERRA_RANGE_TYPE_TO_INT_PROVIDER_TYPE.get(delegate.getClass()); + } +} diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java index 3eb8d813b..62a50c376 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java @@ -1,8 +1,6 @@ package com.dfsek.terra.mod.mixin.gameplay; -import com.dfsek.terra.mod.util.MinecraftAdapter; - import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.ai.brain.task.BoneMealTask; @@ -24,6 +22,7 @@ import com.dfsek.terra.api.util.vector.Vector3Int; import com.dfsek.terra.api.world.WritableWorld; import com.dfsek.terra.mod.config.FertilizableConfig; import com.dfsek.terra.mod.util.BiomeUtil; +import com.dfsek.terra.mod.util.MinecraftAdapter; @Mixin(BoneMealTask.class) @@ -37,9 +36,9 @@ public class BoneMealTaskMixin { Block block = blockState.getBlock(); FertilizableConfig config = map.get(Registry.BLOCK.getId(block)); if(config != null) { - Boolean villagerFertilizable = config.isVillagerFertilizable(); - if(villagerFertilizable != null) { - if(villagerFertilizable) { + Boolean villagerFarmable = config.isVillagerFarmable(); + if(villagerFarmable != null) { + if(villagerFarmable) { Structure canGrow = config.getCanGrow(); if(canGrow != null) { RandomGenerator random = MinecraftAdapter.adapt(world.getRandom()); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java index d1c470076..237a9e550 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/lifecycle/DataPackContentsMixin.java @@ -1,5 +1,7 @@ package com.dfsek.terra.mod.mixin.lifecycle; +import com.dfsek.terra.mod.util.MinecraftUtil; + import net.minecraft.server.DataPackContents; import net.minecraft.util.registry.DynamicRegistryManager; import net.minecraft.util.registry.Registry; diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/DimensionUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/DimensionUtil.java new file mode 100644 index 000000000..234ea2940 --- /dev/null +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/DimensionUtil.java @@ -0,0 +1,62 @@ +package com.dfsek.terra.mod.util; + +import com.dfsek.terra.api.config.ConfigPack; +import com.dfsek.terra.mod.config.VanillaBiomeProperties; +import com.dfsek.terra.mod.config.VanillaWorldProperties; + +import net.minecraft.tag.TagKey; +import net.minecraft.util.Identifier; +import net.minecraft.util.registry.BuiltinRegistries; +import net.minecraft.util.registry.Registry; +import net.minecraft.util.registry.RegistryKey; +import net.minecraft.world.dimension.DimensionOptions; +import net.minecraft.world.dimension.DimensionType; + +import java.util.OptionalLong; + + +public class DimensionUtil { + protected static RegistryKey registerDimension(Identifier identifier, + DimensionType dimension) { + BuiltinRegistries.add(BuiltinRegistries.DIMENSION_TYPE, + registerKey(identifier) + .getValue(), + dimension); + return getDimensionKey(identifier); + } + + public static RegistryKey registerKey(Identifier identifier) { + return RegistryKey.of(Registry.DIMENSION_KEY, identifier); + } + public static RegistryKey getDimensionKey(Identifier identifier) { + return BuiltinRegistries.DIMENSION_TYPE.getKey(BuiltinRegistries.DIMENSION_TYPE.get(identifier)).orElseThrow(); + } + + protected static RegistryKey registerDimension(ConfigPack pack) { + VanillaWorldProperties vanillaWorldProperties; + if (pack.getContext().has(VanillaBiomeProperties.class)) { + vanillaWorldProperties = pack.getContext().get(VanillaWorldProperties.class); + } else { + vanillaWorldProperties = new VanillaWorldProperties(); + } + + DimensionType overworldDimensionType = new DimensionType( + vanillaWorldProperties.getFixedTime() == null ? OptionalLong.empty() : OptionalLong.of(vanillaWorldProperties.getFixedTime()), + vanillaWorldProperties.getHasSkyLight(), + vanillaWorldProperties.getHasCeiling(), + vanillaWorldProperties.getUltraWarm(), + vanillaWorldProperties.getNatural(), + vanillaWorldProperties.getCoordinateScale(), + vanillaWorldProperties.getBedWorks(), + vanillaWorldProperties.getRespawnAnchorWorks(), + vanillaWorldProperties.getHeight().getMin(), + vanillaWorldProperties.getHeight().getMax(), + vanillaWorldProperties.getLogicalHeight(), + TagKey.of(Registry.BLOCK_KEY, vanillaWorldProperties.getInfiniburn()), + vanillaWorldProperties.getEffects(), + vanillaWorldProperties.getAmbientLight(), + vanillaWorldProperties.getMonsterSettings()); + + return registerDimension(new Identifier("terra", pack.getID().toLowerCase()), overworldDimensionType); + } +} diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/MinecraftUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/MinecraftUtil.java index 941f85b2c..fc623fa6c 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/MinecraftUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/MinecraftUtil.java @@ -1,10 +1,17 @@ package com.dfsek.terra.mod.util; +import com.dfsek.terra.api.util.ConstantRange; +import com.dfsek.terra.mod.data.Codecs; + +import com.dfsek.terra.mod.implmentation.TerraIntProvider; + import net.minecraft.block.entity.LootableContainerBlockEntity; import net.minecraft.block.entity.MobSpawnerBlockEntity; import net.minecraft.block.entity.SignBlockEntity; import net.minecraft.util.Identifier; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.intprovider.ConstantIntProvider; +import net.minecraft.util.math.intprovider.IntProviderType; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.RegistryEntry; import net.minecraft.util.registry.RegistryKey; @@ -12,6 +19,7 @@ import net.minecraft.world.WorldAccess; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.Biome.Builder; import net.minecraft.world.biome.BiomeEffects; +import net.minecraft.world.biome.BiomeEffects.GrassColorModifier; import net.minecraft.world.biome.GenerationSettings; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -54,6 +62,13 @@ public final class MinecraftUtil { return null; } + public static void registerIntProviderTypes() { + IntProviderType CONSTANT = IntProviderType.register("terra:constant_range", + Codecs.TERRA_CONSTANT_RANGE_INT_PROVIDER_TYPE); + + TerraIntProvider.TERRA_RANGE_TYPE_TO_INT_PROVIDER_TYPE.put(ConstantRange.class, CONSTANT); + } + public static RegistryKey registerKey(Identifier identifier) { return RegistryKey.of(Registry.BIOME_KEY, identifier); } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java index f4fd942c8..7618678ce 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java @@ -1,11 +1,16 @@ package com.dfsek.terra.mod.util; +import net.minecraft.client.gui.screen.CustomizeBuffetLevelScreen; +import net.minecraft.client.gui.screen.CustomizeFlatLevelScreen; +import net.minecraft.client.gui.screen.world.LevelScreenProvider; import net.minecraft.structure.StructureSet; import net.minecraft.util.Identifier; import net.minecraft.util.math.noise.DoublePerlinNoiseSampler.NoiseParameters; import net.minecraft.util.registry.BuiltinRegistries; +import net.minecraft.util.registry.DynamicRegistryManager; import net.minecraft.util.registry.Registry; import net.minecraft.util.registry.RegistryEntry; +import net.minecraft.util.registry.RegistryKey; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.source.MultiNoiseBiomeSource; import net.minecraft.world.biome.source.TheEndBiomeSource; @@ -13,8 +18,11 @@ import net.minecraft.world.dimension.DimensionOptions; import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.dimension.DimensionTypes; import net.minecraft.world.gen.WorldPreset; +import net.minecraft.world.gen.WorldPresets; import net.minecraft.world.gen.chunk.ChunkGenerator; import net.minecraft.world.gen.chunk.ChunkGeneratorSettings; +import net.minecraft.world.gen.chunk.FlatChunkGenerator; +import net.minecraft.world.gen.chunk.FlatChunkGeneratorConfig; import net.minecraft.world.gen.chunk.NoiseChunkGenerator; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,6 +31,7 @@ import java.util.ArrayList; import java.util.List; import java.util.Locale; import java.util.Map; +import java.util.Optional; import com.dfsek.terra.api.config.ConfigPack; import com.dfsek.terra.api.util.generic.pair.Pair; @@ -34,6 +43,15 @@ public class PresetUtil { private static final Logger LOGGER = LoggerFactory.getLogger(PresetUtil.class); private static final List PRESETS = new ArrayList<>(); + public static RegistryKey getPresetKey(Identifier identifier) { + return RegistryKey.of(Registry.WORLD_PRESET_KEY, identifier); + } + +// public static void addPreset() { +// LevelScreenProvider +// LevelScreenProvider.WORLD_PRESET_TO_SCREEN_PROVIDER.put(Optional.ofNullable(getPresetKey(new Identifier("terra", "terra"))), new TerraPresetScreen()); +// } + public static Pair createDefault(ConfigPack pack) { Registry dimensionTypeRegistry = BuiltinRegistries.DIMENSION_TYPE; Registry chunkGeneratorSettingsRegistry = BuiltinRegistries.CHUNK_GENERATOR_SETTINGS; @@ -58,7 +76,7 @@ public class PresetUtil { new TheEndBiomeSource(biomeRegistry), endChunkGeneratorSettings)); - RegistryEntry overworldDimensionType = dimensionTypeRegistry.getOrCreateEntry(DimensionTypes.OVERWORLD); + RegistryEntry overworldDimensionType = dimensionTypeRegistry.getOrCreateEntry(DimensionUtil.registerDimension(pack)); RegistryEntry overworld = chunkGeneratorSettingsRegistry.getOrCreateEntry(ChunkGeneratorSettings.OVERWORLD); diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/RegistryUtil.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/RegistryUtil.java index 9f17b89e3..aeb57b484 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/RegistryUtil.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/util/RegistryUtil.java @@ -1,5 +1,7 @@ package com.dfsek.terra.lifecycle.util; +import com.dfsek.terra.mod.util.MinecraftUtil; + import net.minecraft.util.Identifier; import net.minecraft.util.registry.Registry; @@ -12,6 +14,7 @@ public final class RegistryUtil { } public static void register() { + MinecraftUtil.registerIntProviderTypes(); Registry.register(Registry.CHUNK_GENERATOR, new Identifier("terra:terra"), Codecs.MINECRAFT_CHUNK_GENERATOR_WRAPPER); Registry.register(Registry.BIOME_SOURCE, new Identifier("terra:terra"), Codecs.TERRA_BIOME_SOURCE); } From 8c16225ed1c4867f27de64b06be370969995111d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sun, 31 Jul 2022 17:43:37 -0700 Subject: [PATCH 06/11] Update ModPlatform.java --- .../src/main/java/com/dfsek/terra/mod/ModPlatform.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java index aae4a9aac..1180c84ab 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java @@ -82,7 +82,7 @@ public abstract class ModPlatform extends AbstractPlatform { .registerLoader(GrassColorModifier.class, (type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase( Locale.ROOT))) - .registerLoader(GrassColorModifier.class, + .registerLoader(TemperatureModifier.class, (type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase( Locale.ROOT))) .registerLoader(SpawnGroup.class, (type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o)) From e658a5d9175701ca5488fed28404baf02882ecb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sun, 31 Jul 2022 22:05:24 -0700 Subject: [PATCH 07/11] fix enum to uppcases --- .../src/main/java/com/dfsek/terra/mod/ModPlatform.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java index 1180c84ab..65feb9e63 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/ModPlatform.java @@ -77,14 +77,11 @@ public abstract class ModPlatform extends AbstractPlatform { throw new LoadException("Invalid identifier: " + o, depthTracker); return identifier; }) - .registerLoader(Precipitation.class, (type, o, loader, depthTracker) -> Precipitation.valueOf(((String) o).toUpperCase( - Locale.ROOT))) + .registerLoader(Precipitation.class, (type, o, loader, depthTracker) -> Precipitation.valueOf(((String) o).toUpperCase())) .registerLoader(GrassColorModifier.class, - (type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase( - Locale.ROOT))) + (type, o, loader, depthTracker) -> GrassColorModifier.valueOf(((String) o).toUpperCase())) .registerLoader(TemperatureModifier.class, - (type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase( - Locale.ROOT))) + (type, o, loader, depthTracker) -> TemperatureModifier.valueOf(((String) o).toUpperCase())) .registerLoader(SpawnGroup.class, (type, o, loader, depthTracker) -> SpawnGroup.valueOf((String) o)) .registerLoader(BiomeParticleConfig.class, BiomeParticleConfigTemplate::new) .registerLoader(SoundEvent.class, SoundEventTemplate::new) From 5d5408e1420aee9bdb0d7361377b78bd8527c743 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Fri, 19 Aug 2022 23:18:42 -0500 Subject: [PATCH 08/11] terraScript random is no more --- .../math/interpolation/Interpolator.java | 22 +++------- .../math/interpolation/Interpolator3.java | 5 ++- .../LazilyEvaluatedInterpolator.java | 18 ++++---- .../structure/StructureCommandAddon.java | 20 +++------ .../addons/flora/flora/gen/TerraFlora.java | 11 ++--- common/addons/config-ore/build.gradle.kts | 1 + .../dfsek/terra/addons/ore/OreFactory.java | 3 +- .../terra/addons/ore/ores/VanillaOre.java | 21 +++++---- .../src/main/resources/terra.addon.yml | 4 +- .../feature/FeatureGenerationStage.java | 6 +-- .../shortcut/block/SingletonStructure.java | 2 +- .../structure/mutator/MutatedStructure.java | 5 +-- .../terra/addons/sponge/SpongeStructure.java | 2 +- .../terrascript/script/StructureScript.java | 10 ++--- .../script/TerraImplementationArguments.java | 8 +--- .../builders/RandomFunctionBuilder.java | 35 --------------- .../script/functions/RandomFunction.java | 43 ------------------- .../script/functions/StructureFunction.java | 15 +------ .../dfsek/terra/api/structure/Structure.java | 3 +- .../com/dfsek/terra/api/util/MathUtil.java | 17 ++++++++ .../mod/mixin/gameplay/BoneMealTaskMixin.java | 5 ++- .../terra/mod/util/FertilizableUtil.java | 4 +- 22 files changed, 84 insertions(+), 176 deletions(-) delete mode 100644 common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/builders/RandomFunctionBuilder.java delete mode 100644 common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/RandomFunction.java diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/Interpolator.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/Interpolator.java index e96e15879..e30a70aae 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/Interpolator.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/Interpolator.java @@ -7,6 +7,9 @@ package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation; +import com.dfsek.terra.api.util.MathUtil; + + /** * Class for bilinear interpolation of values arranged on a unit square. */ @@ -28,19 +31,6 @@ public class Interpolator { this.v3 = v3; } - /** - * 1D Linear interpolation between 2 points 1 unit apart. - * - * @param t - Distance from v0. Total distance between v0 and v1 is 1 unit. - * @param v0 - Value at v0. - * @param v1 - Value at v1. - * - * @return double - The interpolated value. - */ - public static double lerp(double t, double v0, double v1) { - return v0 + t * (v1 - v0); - } - /** * 2D Bilinear interpolation between 4 points on a unit square. * @@ -50,8 +40,8 @@ public class Interpolator { * @return double - The interpolated value. */ public double bilerp(double s, double t) { - double v01 = lerp(s, v0, v1); - double v23 = lerp(s, v2, v3); - return lerp(t, v01, v23); + double v01 = MathUtil.lerp(s, v0, v1); + double v23 = MathUtil.lerp(s, v2, v3); + return MathUtil.lerp(t, v01, v23); } } \ No newline at end of file diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/Interpolator3.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/Interpolator3.java index 804770b42..b313828d3 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/Interpolator3.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/Interpolator3.java @@ -7,6 +7,9 @@ package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation; +import com.dfsek.terra.api.util.MathUtil; + + /** * Class for bilinear interpolation of values arranged on a unit square. */ @@ -34,6 +37,6 @@ public class Interpolator3 { } public double trilerp(double x, double y, double z) { - return Interpolator.lerp(x, top.bilerp(y, z), bottom.bilerp(y, z)); + return MathUtil.lerp(x, top.bilerp(y, z), bottom.bilerp(y, z)); } } \ No newline at end of file diff --git a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/LazilyEvaluatedInterpolator.java b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/LazilyEvaluatedInterpolator.java index f2a48c50a..ecc19d2f9 100644 --- a/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/LazilyEvaluatedInterpolator.java +++ b/common/addons/chunk-generator-noise-3d/src/main/java/com/dfsek/terra/addons/chunkgenerator/generation/math/interpolation/LazilyEvaluatedInterpolator.java @@ -1,13 +1,13 @@ package com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation; +import com.dfsek.terra.api.util.MathUtil; + import net.jafama.FastMath; import com.dfsek.terra.addons.chunkgenerator.config.noise.BiomeNoiseProperties; import com.dfsek.terra.api.properties.PropertyKey; import com.dfsek.terra.api.world.biome.generation.BiomeProvider; -import static com.dfsek.terra.addons.chunkgenerator.generation.math.interpolation.Interpolator.lerp; - public class LazilyEvaluatedInterpolator { private final Double[] samples; // @@ -84,10 +84,10 @@ public class LazilyEvaluatedInterpolator { double xFrac = (double) (x % horizontalRes) / horizontalRes; double zFrac = (double) (z % horizontalRes) / horizontalRes; - double lerp_bottom_0 = lerp(zFrac, sample_0_0_0, sample_0_0_1); - double lerp_bottom_1 = lerp(zFrac, sample_1_0_0, sample_1_0_1); + double lerp_bottom_0 = MathUtil.lerp(zFrac, sample_0_0_0, sample_0_0_1); + double lerp_bottom_1 = MathUtil.lerp(zFrac, sample_1_0_0, sample_1_0_1); - double lerp_bottom = lerp(xFrac, lerp_bottom_0, lerp_bottom_1); + double lerp_bottom = MathUtil.lerp(xFrac, lerp_bottom_0, lerp_bottom_1); if(yRange) { // we can do bilerp return lerp_bottom; @@ -103,11 +103,11 @@ public class LazilyEvaluatedInterpolator { double sample_1_1_0 = sample(xIndex + 1, yIndex + 1, zIndex, x + horizontalRes, y + verticalRes, z); double sample_1_1_1 = sample(xIndex + 1, yIndex + 1, zIndex + 1, x + horizontalRes, y + verticalRes, z + horizontalRes); - double lerp_top_0 = lerp(zFrac, sample_0_1_0, sample_0_1_1); - double lerp_top_1 = lerp(zFrac, sample_1_1_0, sample_1_1_1); + double lerp_top_0 = MathUtil.lerp(zFrac, sample_0_1_0, sample_0_1_1); + double lerp_top_1 = MathUtil.lerp(zFrac, sample_1_1_0, sample_1_1_1); - double lerp_top = lerp(xFrac, lerp_top_0, lerp_top_1); + double lerp_top = MathUtil.lerp(xFrac, lerp_top_0, lerp_top_1); - return lerp(yFrac, lerp_bottom, lerp_top); + return MathUtil.lerp(yFrac, lerp_bottom, lerp_top); } } diff --git a/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java b/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java index dbafef915..8b1dc67c9 100644 --- a/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java +++ b/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java @@ -6,27 +6,24 @@ import cloud.commandframework.arguments.standard.EnumArgument; import cloud.commandframework.arguments.standard.LongArgument; import cloud.commandframework.context.CommandContext; +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; + 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.api.Platform; -import com.dfsek.terra.api.addon.BaseAddon; import com.dfsek.terra.api.command.CommandSender; import com.dfsek.terra.api.command.arguments.RegistryArgument; import com.dfsek.terra.api.entity.Entity; -import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent; import com.dfsek.terra.api.event.events.platform.CommandRegistrationEvent; import com.dfsek.terra.api.event.functional.FunctionalEventHandler; -import com.dfsek.terra.api.inject.annotations.Inject; import com.dfsek.terra.api.registry.Registry; import com.dfsek.terra.api.structure.Structure; import com.dfsek.terra.api.util.Rotation; import com.dfsek.terra.api.util.function.monad.Monad; import com.dfsek.terra.api.util.reflection.TypeKey; -import java.util.random.RandomGenerator; -import java.util.random.RandomGeneratorFactory; public class StructureCommandAddon implements MonadAddonInitializer { private static Registry getStructureRegistry(CommandContext sender) { @@ -42,7 +39,7 @@ public class StructureCommandAddon implements MonadAddonInitializer { handler.register(base, CommandRegistrationEvent.class) .then(event -> { CommandManager manager = event.getCommandManager(); - + manager.command( manager.commandBuilder("structures", ArgumentDescription.of("Manage or generate structures")) .literal("generate") @@ -57,13 +54,8 @@ public class StructureCommandAddon implements MonadAddonInitializer { structure.generate( sender.position().toInt(), sender.world(), - ((Long) context.get("seed") == 0) - ? RandomGeneratorFactory.of("Xoroshiro128PlusPlus") - .create() - : RandomGeneratorFactory.of("Xoroshiro128PlusPlus") - .create(context.get("seed")), - context.get("rotation") - ); + context.get("rotation"), sender.world().getSeed() + ); }) .permission("terra.structures.generate") ); diff --git a/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java b/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java index a28e2b05f..bbbd4fa3e 100644 --- a/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java +++ b/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java @@ -74,7 +74,7 @@ public class TerraFlora implements Structure { } @Override - public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { boolean doRotation = testRotation.size() > 0; int size = layers.size(); int c = ceiling ? -1 : 1; @@ -86,13 +86,8 @@ public class TerraFlora implements Structure { for(int i = 0; FastMath.abs(i) < size; i += c) { // Down if ceiling, up if floor int lvl = (FastMath.abs(i)); BlockState data = getStateCollection((ceiling ? lvl : size - lvl - 1)).get(distribution, location.getX(), location.getY(), - location.getZ(), world.getSeed()); - if(doRotation) { - Direction oneFace = new ArrayList<>(faces).get( - RandomGeneratorFactory.of("Xoroshiro128PlusPlus") - .create(location.getX() ^ location.getZ()) - .nextInt(faces.size())); // Get RandomGenerator face. - } + location.getZ(), seed); + world.setBlockState(location.mutable().add(0, i + c, 0).immutable(), data, physics); } return true; diff --git a/common/addons/config-ore/build.gradle.kts b/common/addons/config-ore/build.gradle.kts index d575f43d3..bd59de3b5 100644 --- a/common/addons/config-ore/build.gradle.kts +++ b/common/addons/config-ore/build.gradle.kts @@ -4,6 +4,7 @@ dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) + compileOnlyApi(project(":common:addons:config-noise-function")) } tasks.named("shadowJar") { diff --git a/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/OreFactory.java b/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/OreFactory.java index 9d8b1055a..1d824a00a 100644 --- a/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/OreFactory.java +++ b/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/OreFactory.java @@ -7,6 +7,7 @@ package com.dfsek.terra.addons.ore; +import com.dfsek.terra.addons.noise.samplers.noise.random.WhiteNoiseSampler; import com.dfsek.terra.addons.ore.ores.VanillaOre; import com.dfsek.terra.api.Platform; import com.dfsek.terra.api.block.state.BlockState; @@ -19,6 +20,6 @@ public class OreFactory implements ConfigFactory { public VanillaOre build(OreTemplate config, Platform platform) { BlockState m = config.getMaterial(); return new VanillaOre(m, config.getSize(), config.getReplaceable(), config.doPhysics(), config.isExposed(), - config.getMaterialOverrides()); + config.getMaterialOverrides(), new WhiteNoiseSampler()); } } diff --git a/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java b/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java index 7f3a781d7..02e98dd56 100644 --- a/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java +++ b/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java @@ -7,10 +7,13 @@ package com.dfsek.terra.addons.ore.ores; +import com.dfsek.terra.api.noise.NoiseSampler; + +import com.dfsek.terra.api.util.MathUtil; + import net.jafama.FastMath; import java.util.Map; -import java.util.random.RandomGenerator; import com.dfsek.terra.api.block.BlockType; import com.dfsek.terra.api.block.state.BlockState; @@ -30,38 +33,40 @@ public class VanillaOre implements Structure { private final boolean applyGravity; private final double exposed; private final Map materials; + private final NoiseSampler sampler; public VanillaOre(BlockState material, double size, MaterialSet replaceable, boolean applyGravity, - double exposed, Map materials) { + double exposed, Map materials, NoiseSampler sampler) { this.material = material; this.size = size; this.replaceable = replaceable; this.applyGravity = applyGravity; this.exposed = exposed; this.materials = materials; + this.sampler = sampler; } @Override - public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed){ int centerX = location.getX(); int centerZ = location.getZ(); int centerY = location.getY(); - float f = random.nextFloat() * (float) Math.PI; + double f = sampler.noise(centerX, centerY, centerZ, seed) * (float) Math.PI; double d1 = centerX + 8 + FastMath.sin(f) * size / 8.0F; double d2 = centerX + 8 - FastMath.sin(f) * size / 8.0F; double d3 = centerZ + 8 + FastMath.cos(f) * size / 8.0F; double d4 = centerZ + 8 - FastMath.cos(f) * size / 8.0F; - double d5 = centerY + random.nextInt(3) - 2D; - double d6 = centerY + random.nextInt(3) - 2D; + double d5 = centerY + (Math.round(sampler.noise(centerX, centerY, centerZ, seed + 1) + 1)) - 2D; + double d6 = centerY + (Math.round(sampler.noise(centerX, centerY, centerZ, seed + 2) + 1)) - 2D; for(int i = 0; i < size; i++) { float iFactor = (float) i / (float) size; - double d10 = random.nextDouble() * size / 16.0D; + double d10 = MathUtil.inverseLerp(sampler.noise(centerX, centerY, centerZ, seed + 2 + (i * 2 - 1)), -1, 1) * size / 16.0D; double d11 = (FastMath.sin(Math.PI * iFactor) + 1.0) * d10 + 1.0; double d12 = (FastMath.sin(Math.PI * iFactor) + 1.0) * d10 + 1.0; @@ -85,7 +90,7 @@ public class VanillaOre implements Structure { if(y >= world.getMaxHeight() || y < world.getMinHeight()) continue; BlockType block = world.getBlockState(x, y, z).getBlockType(); if((d13 * d13 + d14 * d14 + d15 * d15 < 1.0D) && getReplaceable().contains(block)) { - if(exposed > random.nextDouble() || !(world.getBlockState(x, y, z - 1).isAir() || + if(exposed > MathUtil.inverseLerp(sampler.noise(centerX, centerY, centerZ, seed + 2 + (i * 2)), -1, 1) || !(world.getBlockState(x, y, z - 1).isAir() || world.getBlockState(x, y, z + 1).isAir() || world.getBlockState(x, y - 1, z).isAir() || world.getBlockState(x, y + 1, z).isAir() || diff --git a/common/addons/config-ore/src/main/resources/terra.addon.yml b/common/addons/config-ore/src/main/resources/terra.addon.yml index 60ea05e60..d83bcb3cc 100644 --- a/common/addons/config-ore/src/main/resources/terra.addon.yml +++ b/common/addons/config-ore/src/main/resources/terra.addon.yml @@ -9,4 +9,6 @@ website: issues: https://github.com/PolyhedralDev/Terra/issues source: https://github.com/PolyhedralDev/Terra docs: https://terra.polydev.org -license: MIT License \ No newline at end of file +license: MIT License +depends: + config-noise-function: "1.+" \ No newline at end of file diff --git a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java index 150e381d4..6b300d778 100644 --- a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java +++ b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java @@ -73,10 +73,8 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab .forEach(y -> feature.getStructure(world, x, y, z) .generate(Vector3Int.of(x, y, z), world, - RandomGeneratorFactory.of( - "Xoroshiro128PlusPlus") - .create(coordinateSeed * 31 + y), - Rotation.NONE) + Rotation.NONE, + coordinateSeed * 31 + y) ); } platform.getProfiler().pop(feature.getID()); diff --git a/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java b/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java index d7fba683f..831857c1f 100644 --- a/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java +++ b/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java @@ -17,7 +17,7 @@ public class SingletonStructure implements Structure { } @Override - public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { world.setBlockState(location, blockState); return true; } diff --git a/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java b/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java index 8ff16d9db..9b5bbb90c 100644 --- a/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java +++ b/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java @@ -32,13 +32,12 @@ public class MutatedStructure implements Structure, Keyed { } @Override - public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { return base.generate(location, world .buffer() .read(readInterceptor) .write(writeInterceptor) - .build(), - random, rotation); + .build(), rotation, seed); } } diff --git a/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java b/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java index 1e3cf7f0c..ef290b66c 100644 --- a/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java +++ b/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java @@ -31,7 +31,7 @@ public class SpongeStructure implements Structure, Keyed { } @Override - public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { int bX = location.getX(); int bY = location.getY(); int bZ = location.getZ(); diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java index 9a9d040ff..d58975640 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java @@ -29,7 +29,6 @@ import com.dfsek.terra.addons.terrascript.script.builders.EntityFunctionBuilder; import com.dfsek.terra.addons.terrascript.script.builders.GetMarkFunctionBuilder; import com.dfsek.terra.addons.terrascript.script.builders.LootFunctionBuilder; import com.dfsek.terra.addons.terrascript.script.builders.PullFunctionBuilder; -import com.dfsek.terra.addons.terrascript.script.builders.RandomFunctionBuilder; import com.dfsek.terra.addons.terrascript.script.builders.RecursionsFunctionBuilder; import com.dfsek.terra.addons.terrascript.script.builders.SetMarkFunctionBuilder; import com.dfsek.terra.addons.terrascript.script.builders.StateFunctionBuilder; @@ -77,7 +76,6 @@ public class StructureScript implements Structure, Keyed { .registerFunction("block", new BlockFunctionBuilder(platform)) .registerFunction("debugBlock", new BlockFunctionBuilder(platform)) .registerFunction("structure", new StructureFunctionBuilder(registry, platform)) - .registerFunction("randomInt", new RandomFunctionBuilder()) .registerFunction("recursions", new RecursionsFunctionBuilder()) .registerFunction("setMark", new SetMarkFunctionBuilder()) .registerFunction("getMark", new GetMarkFunctionBuilder()) @@ -130,16 +128,16 @@ public class StructureScript implements Structure, Keyed { @Override @SuppressWarnings("try") - public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { platform.getProfiler().push(profile); - boolean result = applyBlock(new TerraImplementationArguments(location, rotation, random, world, 0)); + boolean result = applyBlock(new TerraImplementationArguments(location, rotation, world, 0)); platform.getProfiler().pop(profile); return result; } - public boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation, int recursions) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, int recursions) { platform.getProfiler().push(profile); - boolean result = applyBlock(new TerraImplementationArguments(location, rotation, random, world, recursions)); + boolean result = applyBlock(new TerraImplementationArguments(location, rotation, world, recursions)); platform.getProfiler().pop(profile); return result; } diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/TerraImplementationArguments.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/TerraImplementationArguments.java index d768b30ec..4844b2d9e 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/TerraImplementationArguments.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/TerraImplementationArguments.java @@ -20,16 +20,14 @@ import com.dfsek.terra.api.world.WritableWorld; public class TerraImplementationArguments implements ImplementationArguments { private final Rotation rotation; - private final RandomGenerator random; private final WritableWorld world; private final Map marks = new HashMap<>(); private final int recursions; private final Vector3Int origin; private boolean waterlog = false; - public TerraImplementationArguments(Vector3Int origin, Rotation rotation, RandomGenerator random, WritableWorld world, int recursions) { + public TerraImplementationArguments(Vector3Int origin, Rotation rotation, WritableWorld world, int recursions) { this.rotation = rotation; - this.random = random; this.world = world; this.recursions = recursions; this.origin = origin; @@ -39,10 +37,6 @@ public class TerraImplementationArguments implements ImplementationArguments { return recursions; } - public RandomGenerator getRandom() { - return random; - } - public Rotation getRotation() { return rotation; } diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/builders/RandomFunctionBuilder.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/builders/RandomFunctionBuilder.java deleted file mode 100644 index 6cfeaa52d..000000000 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/builders/RandomFunctionBuilder.java +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.terrascript.script.builders; - -import java.util.List; - -import com.dfsek.terra.addons.terrascript.parser.lang.Returnable; -import com.dfsek.terra.addons.terrascript.parser.lang.functions.FunctionBuilder; -import com.dfsek.terra.addons.terrascript.script.functions.RandomFunction; -import com.dfsek.terra.addons.terrascript.tokenizer.Position; - - -public class RandomFunctionBuilder implements FunctionBuilder { - @SuppressWarnings("unchecked") - @Override - public RandomFunction build(List> argumentList, Position position) { - return new RandomFunction((Returnable) argumentList.get(0), position); - } - - @Override - public int argNumber() { - return 1; - } - - @Override - public Returnable.ReturnType getArgument(int position) { - if(position == 0) return Returnable.ReturnType.NUMBER; - return null; - } -} diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/RandomFunction.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/RandomFunction.java deleted file mode 100644 index 3170d2645..000000000 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/RandomFunction.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.terrascript.script.functions; - -import com.dfsek.terra.addons.terrascript.parser.lang.ImplementationArguments; -import com.dfsek.terra.addons.terrascript.parser.lang.Returnable; -import com.dfsek.terra.addons.terrascript.parser.lang.Scope; -import com.dfsek.terra.addons.terrascript.parser.lang.functions.Function; -import com.dfsek.terra.addons.terrascript.script.TerraImplementationArguments; -import com.dfsek.terra.addons.terrascript.tokenizer.Position; - - -public class RandomFunction implements Function { - private final Returnable numberReturnable; - private final Position position; - - public RandomFunction(Returnable numberReturnable, Position position) { - this.numberReturnable = numberReturnable; - this.position = position; - } - - - @Override - public ReturnType returnType() { - return ReturnType.NUMBER; - } - - @Override - public Integer apply(ImplementationArguments implementationArguments, Scope scope) { - return ((TerraImplementationArguments) implementationArguments).getRandom().nextInt( - numberReturnable.apply(implementationArguments, scope).intValue()); - } - - @Override - public Position getPosition() { - return position; - } -} diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/StructureFunction.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/StructureFunction.java index 51fb47054..57c7dd943 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/StructureFunction.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/StructureFunction.java @@ -67,31 +67,20 @@ public class StructureFunction implements Function { String app = id.apply(implementationArguments, scope); return registry.getByID(app).map(script -> { - Rotation rotation1; - String rotString = rotations.get(arguments.getRandom().nextInt(rotations.size())).apply(implementationArguments, scope); - try { - rotation1 = Rotation.valueOf(rotString); - } catch(IllegalArgumentException e) { - LOGGER.warn("Invalid rotation {}", rotString); - return false; - } - if(script instanceof StructureScript structureScript) { return structureScript.generate(arguments.getOrigin(), arguments.getWorld() .buffer(FastMath.roundToInt(xz.getX()), y.apply(implementationArguments, scope).intValue(), FastMath.roundToInt(xz.getZ())), - arguments.getRandom(), - arguments.getRotation().rotate(rotation1), arguments.getRecursions() + 1); + arguments.getRotation(), arguments.getRecursions() + 1); } return script.generate(arguments.getOrigin(), arguments.getWorld() .buffer(FastMath.roundToInt(xz.getX()), y.apply(implementationArguments, scope).intValue(), FastMath.roundToInt(xz.getZ())), - arguments.getRandom(), - arguments.getRotation().rotate(rotation1)); + arguments.getRotation(), arguments.getWorld().getSeed()); }).orElseGet(() -> { LOGGER.error("No such structure {}", app); return false; diff --git a/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java b/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java index 20aa70d1d..48fb5a069 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java +++ b/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java @@ -9,11 +9,12 @@ package com.dfsek.terra.api.structure; import java.util.random.RandomGenerator; +import com.dfsek.terra.api.noise.NoiseSampler; import com.dfsek.terra.api.util.Rotation; import com.dfsek.terra.api.util.vector.Vector3Int; import com.dfsek.terra.api.world.WritableWorld; public interface Structure { - boolean generate(Vector3Int location, WritableWorld world, RandomGenerator random, Rotation rotation); + boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long Seed); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java index 3c95df139..8e78f1f8b 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java +++ b/common/api/src/main/java/com/dfsek/terra/api/util/MathUtil.java @@ -173,4 +173,21 @@ public final class MathUtil { return mu + sigma * val; } + + /** + * 1D Linear interpolation between 2 points 1 unit apart. + * + * @param t - Distance from v0. Total distance between v0 and v1 is 1 unit. + * @param v0 - Value at v0. + * @param v1 - Value at v1. + * + * @return double - The interpolated value. + */ + public static double lerp(double t, double v0, double v1) { + return v0 + t * (v1 - v0); + } + + public static double inverseLerp(double t, double v0, double v1) { + return (t - v0) / (v1 - v0); + } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java index 62a50c376..df17f905a 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java @@ -1,6 +1,8 @@ package com.dfsek.terra.mod.mixin.gameplay; +import com.dfsek.terra.api.world.World; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.ai.brain.task.BoneMealTask; @@ -43,14 +45,13 @@ public class BoneMealTaskMixin { if(canGrow != null) { RandomGenerator random = MinecraftAdapter.adapt(world.getRandom()); cir.setReturnValue(canGrow.generate( - Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE)); + Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, Rotation.NONE, world.getSeed() + random.nextLong(Long.MAX_VALUE))); return; } cir.setReturnValue(true); return; } cir.setReturnValue(false); - return; } } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java index a550660ca..fcb4e87bd 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java @@ -27,7 +27,7 @@ public class FertilizableUtil { Structure canGrow = config.getCanGrow(); if(canGrow != null) { if(!canGrow.generate( - Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE)) { + Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, Rotation.NONE, world.getSeed() + random.nextLong(Long.MAX_VALUE))) { return false; } } @@ -38,7 +38,7 @@ public class FertilizableUtil { } } config.getStructures().get(random).generate( - Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, random, Rotation.NONE); + Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, Rotation.NONE, world.getSeed() + random.nextLong(Long.MAX_VALUE)); return true; } } From b627ce6e583c9498228427379a2e526077e0332a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sun, 21 Aug 2022 12:21:12 -0500 Subject: [PATCH 09/11] Update libs and use libs.versions.toml for dep management --- buildSrc/build.gradle.kts | 24 +- buildSrc/settings.gradle.kts | 7 + buildSrc/src/main/kotlin/DependencyConfig.kt | 19 +- buildSrc/src/main/kotlin/Helper.kt | 12 + buildSrc/src/main/kotlin/Versions.kt | 72 ----- .../biome-provider-image/build.gradle.kts | 6 - .../biome-provider-pipeline/build.gradle.kts | 7 - .../chunk-generator-noise-3d/build.gradle.kts | 7 - .../config-distributors/build.gradle.kts | 7 - common/addons/config-flora/build.gradle.kts | 6 - .../addons/config-locators/build.gradle.kts | 7 - .../config-noise-function/build.gradle.kts | 9 - common/addons/config-ore/build.gradle.kts | 6 - .../addons/config-structure/build.gradle.kts | 10 +- .../structure/structures/loot/Entry.java | 109 ------- .../structures/loot/LootTableImpl.java | 80 ------ .../structure/structures/loot/Pool.java | 69 ----- .../loot/functions/AmountFunction.java | 47 --- .../loot/functions/DamageFunction.java | 54 ---- .../loot/functions/EnchantFunction.java | 82 ------ .../loot/functions/LootFunction.java | 29 -- common/addons/language-yaml/build.gradle.kts | 2 +- .../manifest-addon-loader/build.gradle.kts | 4 +- .../build.gradle.kts | 11 +- .../build.gradle.kts | 7 - common/api/build.gradle.kts | 18 +- common/implementation/base/build.gradle.kts | 12 +- gradle/libs.versions.toml | 98 +++++++ gradle/wrapper/gradle-wrapper.jar | Bin 59203 -> 59821 bytes gradle/wrapper/gradle-wrapper.properties | 3 +- gradlew | 269 +++++++++++------- platforms/bukkit/build.gradle.kts | 9 +- platforms/bukkit/common/build.gradle.kts | 11 +- .../bukkit/nms/v1_19_R1/build.gradle.kts | 4 +- platforms/cli/build.gradle.kts | 10 +- platforms/fabric/build.gradle.kts | 34 +-- platforms/forge/build.gradle.kts | 19 +- platforms/mixin-common/build.gradle.kts | 16 +- .../MinecraftChunkGeneratorWrapper.java | 2 +- .../terra/mod/mixin/access/BiomeAccessor.java | 12 - .../src/main/resources/terra.accesswidener | 3 +- platforms/mixin-lifecycle/build.gradle.kts | 22 +- .../terra/lifecycle/LifecycleEntryPoint.java | 24 +- platforms/quilt/build.gradle.kts | 24 +- settings.gradle.kts | 4 + 45 files changed, 394 insertions(+), 893 deletions(-) create mode 100644 buildSrc/settings.gradle.kts create mode 100644 buildSrc/src/main/kotlin/Helper.kt delete mode 100644 buildSrc/src/main/kotlin/Versions.kt delete mode 100644 common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Entry.java delete mode 100644 common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/LootTableImpl.java delete mode 100644 common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Pool.java delete mode 100644 common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/AmountFunction.java delete mode 100644 common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/DamageFunction.java delete mode 100644 common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/EnchantFunction.java delete mode 100644 common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/LootFunction.java create mode 100644 gradle/libs.versions.toml delete mode 100644 platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/access/BiomeAccessor.java diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index d6fbe2a8f..a246ea517 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -3,32 +3,20 @@ plugins { kotlin("jvm") version embeddedKotlinVersion } -buildscript { - configurations.all { - resolutionStrategy { - force("org.ow2.asm:asm:9.3") // TODO: remove when ShadowJar updates ASM version - force("org.ow2.asm:asm-commons:9.3") - } - } -} - repositories { mavenCentral() gradlePluginPortal() maven("https://repo.codemc.org/repository/maven-public") { name = "CodeMC" } - maven("https://papermc.io/repo/repository/maven-public/") { - name = "PaperMC" - } } dependencies { - implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:+") - implementation("io.papermc.paperweight.userdev:io.papermc.paperweight.userdev.gradle.plugin:1.3.5") + implementation(libs.libraries.internal.shadow) + - implementation("org.ow2.asm:asm:9.3") - implementation("org.ow2.asm:asm-tree:9.3") - implementation("com.dfsek.tectonic:common:4.2.0") - implementation("org.yaml:snakeyaml:1.27") + implementation(libs.libraries.internal.asm) + implementation(libs.libraries.internal.asm.tree) + implementation(libs.libraries.tectonic) + implementation(libs.libraries.snakeyaml) } \ No newline at end of file diff --git a/buildSrc/settings.gradle.kts b/buildSrc/settings.gradle.kts new file mode 100644 index 000000000..fa8bc7492 --- /dev/null +++ b/buildSrc/settings.gradle.kts @@ -0,0 +1,7 @@ +dependencyResolutionManagement { + versionCatalogs { + create("libs") { + from(files("../gradle/libs.versions.toml")) + } + } +} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/DependencyConfig.kt b/buildSrc/src/main/kotlin/DependencyConfig.kt index b0e7d32c4..4fb94d820 100644 --- a/buildSrc/src/main/kotlin/DependencyConfig.kt +++ b/buildSrc/src/main/kotlin/DependencyConfig.kt @@ -5,6 +5,8 @@ import org.gradle.kotlin.dsl.getValue import org.gradle.kotlin.dsl.getting import org.gradle.kotlin.dsl.maven import org.gradle.kotlin.dsl.repositories +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.kotlin.dsl.apply fun Project.configureDependencies() { val testImplementation by configurations.getting @@ -15,6 +17,8 @@ fun Project.configureDependencies() { val shaded by configurations.creating + val libs = rootProject.project.versionCatalogs.libs + @Suppress("UNUSED_VARIABLE") val shadedApi by configurations.creating { shaded.extendsFrom(this) @@ -48,14 +52,17 @@ fun Project.configureDependencies() { maven("https://jitpack.io") { name = "JitPack" } + maven("Modrinth") { + url = uri("https://api.modrinth.com/maven") + } } dependencies { - testImplementation("org.junit.jupiter:junit-jupiter-api:5.7.0") - testImplementation("org.junit.jupiter:junit-jupiter-engine:5.7.0") - compileOnly("org.jetbrains:annotations:23.0.0") - - compileOnly("com.google.guava:guava:30.0-jre") - testImplementation("com.google.guava:guava:30.0-jre") + testImplementation(libs.findLibrary("libraries.internal.junit.jupiter.api").get()) + testImplementation(libs.findLibrary("libraries.internal.junit.jupiter.engine").get()) + compileOnly(libs.findLibrary("libraries.internal.jetbrains.annotations").get()) + + compileOnly(libs.findLibrary("libraries.guava").get()) + testImplementation(libs.findLibrary("libraries.guava").get()) } } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Helper.kt b/buildSrc/src/main/kotlin/Helper.kt new file mode 100644 index 000000000..e77c7ff6e --- /dev/null +++ b/buildSrc/src/main/kotlin/Helper.kt @@ -0,0 +1,12 @@ +import org.gradle.api.artifacts.VersionCatalogsExtension +import org.gradle.api.artifacts.VersionCatalog +import org.gradle.api.Project +import org.gradle.kotlin.dsl.* + +internal +val Project.versionCatalogs: VersionCatalogsExtension + get() = the() + +internal +val VersionCatalogsExtension.libs: VersionCatalog + get() = named("libs") \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt deleted file mode 100644 index c7f2e5ba3..000000000 --- a/buildSrc/src/main/kotlin/Versions.kt +++ /dev/null @@ -1,72 +0,0 @@ -object Versions { - object Libraries { - const val tectonic = "4.2.0" - const val paralithic = "0.7.0" - const val strata = "1.1.1" - - const val cloud = "1.7.0" - - const val slf4j = "1.7.36" - const val log4j_slf4j_impl = "2.14.1" - - const val caffeine = "3.1.0" - const val vavr = "0.10.4" - - object Internal { - const val apacheText = "1.9" - const val jafama = "2.3.2" - const val apacheIO = "2.6" - const val fastutil = "8.5.6" - } - } - - object Fabric { - const val fabricLoader = "0.14.8" - const val fabricAPI = "0.57.0+1.19" - } - - object Quilt { - const val quiltLoader = "0.17.0" - const val fabricApi = "2.0.0-beta.4+0.57.0-1.19" - } - - object Mod { - const val mixin = "0.11.2+mixin.0.8.5" - - const val minecraft = "1.19" - const val yarn = "$minecraft+build.1" - const val fabricLoader = "0.14.2" - - const val architecuryLoom = "0.12.0.290" - const val architecturyPlugin = "3.4-SNAPSHOT" - - const val loomQuiltflower = "1.7.1" - - const val lazyDfu = "0.1.2" - } - - object Forge { - const val forge = "${Mod.minecraft}-41.0.63" - const val burningwave = "12.53.0" - } - - object Bukkit { - const val paper = "1.18.2-R0.1-SNAPSHOT" - const val paperLib = "1.0.5" - const val minecraft = "1.19" - const val reflectionRemapper = "0.1.0-SNAPSHOT" - } - - object Sponge { - const val sponge = "9.0.0-SNAPSHOT" - const val mixin = "0.8.2" - const val minecraft = "1.17.1" - } - - object CLI { - const val nbt = "6.1" - const val logback = "1.2.9" - const val commonsIO = "2.7" - const val guava = "31.0.1-jre" - } -} \ No newline at end of file diff --git a/common/addons/biome-provider-image/build.gradle.kts b/common/addons/biome-provider-image/build.gradle.kts index 15145b578..d3eaff9fe 100644 --- a/common/addons/biome-provider-image/build.gradle.kts +++ b/common/addons/biome-provider-image/build.gradle.kts @@ -2,10 +2,4 @@ version = version("1.0.0") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addons.biome.image.lib.jafama") } \ No newline at end of file diff --git a/common/addons/biome-provider-pipeline/build.gradle.kts b/common/addons/biome-provider-pipeline/build.gradle.kts index 2629ac476..f0b8af23a 100644 --- a/common/addons/biome-provider-pipeline/build.gradle.kts +++ b/common/addons/biome-provider-pipeline/build.gradle.kts @@ -2,11 +2,4 @@ version = version("1.0.1") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) - - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addons.biome.pipeline.lib.jafama") } \ No newline at end of file diff --git a/common/addons/chunk-generator-noise-3d/build.gradle.kts b/common/addons/chunk-generator-noise-3d/build.gradle.kts index 685cc848c..84c179738 100644 --- a/common/addons/chunk-generator-noise-3d/build.gradle.kts +++ b/common/addons/chunk-generator-noise-3d/build.gradle.kts @@ -2,11 +2,4 @@ version = version("1.1.0") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) - - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addons.chunkgenerator.lib.jafama") } diff --git a/common/addons/config-distributors/build.gradle.kts b/common/addons/config-distributors/build.gradle.kts index e38fb40ee..d3eaff9fe 100644 --- a/common/addons/config-distributors/build.gradle.kts +++ b/common/addons/config-distributors/build.gradle.kts @@ -2,11 +2,4 @@ version = version("1.0.0") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) - - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addons.feature.distributor.lib.jafama") } \ No newline at end of file diff --git a/common/addons/config-flora/build.gradle.kts b/common/addons/config-flora/build.gradle.kts index 9e1e78d1f..9d0aac37f 100644 --- a/common/addons/config-flora/build.gradle.kts +++ b/common/addons/config-flora/build.gradle.kts @@ -2,10 +2,4 @@ version = version("1.0.0") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addons.flora.lib.jafama") } diff --git a/common/addons/config-locators/build.gradle.kts b/common/addons/config-locators/build.gradle.kts index 50fc70400..84c179738 100644 --- a/common/addons/config-locators/build.gradle.kts +++ b/common/addons/config-locators/build.gradle.kts @@ -2,11 +2,4 @@ version = version("1.1.0") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) - - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addons.feature.locator.lib.jafama") } diff --git a/common/addons/config-noise-function/build.gradle.kts b/common/addons/config-noise-function/build.gradle.kts index f51d5e878..1193d5cf5 100644 --- a/common/addons/config-noise-function/build.gradle.kts +++ b/common/addons/config-noise-function/build.gradle.kts @@ -4,13 +4,4 @@ version = version("1.0.0") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) - api("com.dfsek", "paralithic", Versions.Libraries.paralithic) - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - - -tasks.named("shadowJar") { - relocate("com.dfsek.paralithic", "com.dfsek.terra.addons.noise.lib.paralithic") - relocate("net.jafama", "com.dfsek.terra.addons.noise.lib.jafama") } \ No newline at end of file diff --git a/common/addons/config-ore/build.gradle.kts b/common/addons/config-ore/build.gradle.kts index bd59de3b5..4e7e1d975 100644 --- a/common/addons/config-ore/build.gradle.kts +++ b/common/addons/config-ore/build.gradle.kts @@ -2,11 +2,5 @@ version = version("1.0.0") dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) compileOnlyApi(project(":common:addons:config-noise-function")) } - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addons.ore.lib.jafama") -} diff --git a/common/addons/config-structure/build.gradle.kts b/common/addons/config-structure/build.gradle.kts index dad8fff7d..d3eaff9fe 100644 --- a/common/addons/config-structure/build.gradle.kts +++ b/common/addons/config-structure/build.gradle.kts @@ -1,13 +1,5 @@ version = version("1.0.0") dependencies { - api("com.googlecode.json-simple:json-simple:1.1.1") compileOnlyApi(project(":common:addons:manifest-addon-loader")) - - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addons.structure.lib.jafama") -} +} \ No newline at end of file diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Entry.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Entry.java deleted file mode 100644 index 4acfce6e6..000000000 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Entry.java +++ /dev/null @@ -1,109 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.structure.structures.loot; - -import net.jafama.FastMath; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; - -import java.util.ArrayList; -import java.util.List; -import java.util.random.RandomGenerator; - -import com.dfsek.terra.addons.structure.structures.loot.functions.AmountFunction; -import com.dfsek.terra.addons.structure.structures.loot.functions.DamageFunction; -import com.dfsek.terra.addons.structure.structures.loot.functions.EnchantFunction; -import com.dfsek.terra.addons.structure.structures.loot.functions.LootFunction; -import com.dfsek.terra.api.Platform; -import com.dfsek.terra.api.inventory.Item; -import com.dfsek.terra.api.inventory.ItemStack; - - -/** - * Representation of a single item entry within a Loot Table pool. - */ -public class Entry { - private final Item item; - private final long weight; - private final List functions = new ArrayList<>(); - - /** - * Instantiates an Entry from a JSON representation. - * - * @param entry The JSON Object to instantiate from. - */ - public Entry(JSONObject entry, Platform platform) { - String id = entry.get("name").toString(); - this.item = platform.getItemHandle().createItem(id); - - long weight1; - try { - weight1 = (long) entry.get("weight"); - } catch(NullPointerException e) { - weight1 = 1; - } - - this.weight = weight1; - if(entry.containsKey("functions")) { - for(Object function : (JSONArray) entry.get("functions")) { - switch(((String) ((JSONObject) function).get("function"))) { - case "minecraft:set_count", "set_count" -> { - Object loot = ((JSONObject) function).get("count"); - long max, min; - if(loot instanceof Long) { - max = (Long) loot; - min = (Long) loot; - } else { - max = (long) ((JSONObject) loot).get("max"); - min = (long) ((JSONObject) loot).get("min"); - } - functions.add(new AmountFunction(FastMath.toIntExact(min), FastMath.toIntExact(max))); - } - case "minecraft:set_damage", "set_damage" -> { - long maxDamage = (long) ((JSONObject) ((JSONObject) function).get("damage")).get("max"); - long minDamage = (long) ((JSONObject) ((JSONObject) function).get("damage")).get("min"); - functions.add(new DamageFunction(FastMath.toIntExact(minDamage), FastMath.toIntExact(maxDamage))); - } - case "minecraft:enchant_with_levels", "enchant_with_levels" -> { - long maxEnchant = (long) ((JSONObject) ((JSONObject) function).get("levels")).get("max"); - long minEnchant = (long) ((JSONObject) ((JSONObject) function).get("levels")).get("min"); - JSONArray disabled = null; - if(((JSONObject) function).containsKey("disabled_enchants")) - disabled = (JSONArray) ((JSONObject) function).get("disabled_enchants"); - functions.add( - new EnchantFunction(FastMath.toIntExact(minEnchant), FastMath.toIntExact(maxEnchant), disabled, platform)); - } - } - } - } - } - - /** - * Fetches a single ItemStack from the Entry, applying all functions to it. - * - * @param r The RandomGenerator instance to apply functions with - * - * @return ItemStack - The ItemStack with all functions applied. - */ - public ItemStack getItem(RandomGenerator r) { - ItemStack item = this.item.newItemStack(1); - for(LootFunction f : functions) { - item = f.apply(item, r); - } - return item; - } - - /** - * Gets the weight attribute of the Entry. - * - * @return long - The weight of the Entry. - */ - public long getWeight() { - return this.weight; - } -} diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/LootTableImpl.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/LootTableImpl.java deleted file mode 100644 index 6caeb9052..000000000 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/LootTableImpl.java +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.structure.structures.loot; - -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; -import org.json.simple.parser.JSONParser; -import org.json.simple.parser.ParseException; - -import java.util.ArrayList; -import java.util.List; -import java.util.random.RandomGenerator; - -import com.dfsek.terra.api.Platform; -import com.dfsek.terra.api.inventory.Inventory; -import com.dfsek.terra.api.inventory.ItemStack; - - -/** - * Class representation of a Loot Table to populate chest loot. - */ -public class LootTableImpl implements com.dfsek.terra.api.structure.LootTable { - private final List pools = new ArrayList<>(); - - /** - * Instantiates a LootTable from a JSON String. - * - * @param json The JSON String representing the loot table. - * - * @throws ParseException if malformed JSON is passed. - */ - public LootTableImpl(String json, Platform platform) throws ParseException { - JSONParser jsonParser = new JSONParser(); - Object tableJSON = jsonParser.parse(json); - JSONArray poolArray = (JSONArray) ((JSONObject) tableJSON).get("pools"); - for(Object pool : poolArray) { - pools.add(new Pool((JSONObject) pool, platform)); - } - } - - @Override - public void fillInventory(Inventory i, RandomGenerator r) { - List loot = getLoot(r); - for(ItemStack stack : loot) { - int attempts = 0; - while(stack.getAmount() != 0 && attempts < 10) { - ItemStack newStack = stack.getType().newItemStack(stack.getAmount()); - newStack.setItemMeta(stack.getItemMeta()); - newStack.setAmount(1); - int slot = r.nextInt(i.getSize()); - ItemStack slotItem = i.getItem(slot); - if(slotItem == null) { - i.setItem(slot, newStack); - stack.setAmount(stack.getAmount() - 1); - } else if(slotItem.getType().equals(newStack.getType())) { - ItemStack dep = newStack.getType().newItemStack(newStack.getAmount()); - dep.setItemMeta(newStack.getItemMeta()); - dep.setAmount(newStack.getAmount() + slotItem.getAmount()); - i.setItem(slot, dep); - stack.setAmount(stack.getAmount() - 1); - } - attempts++; - } - } - } - - @Override - public List getLoot(RandomGenerator r) { - List itemList = new ArrayList<>(); - for(Pool pool : pools) { - itemList.addAll(pool.getItems(r)); - } - return itemList; - } -} diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Pool.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Pool.java deleted file mode 100644 index fa29a5090..000000000 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/Pool.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.structure.structures.loot; - -import net.jafama.FastMath; -import org.json.simple.JSONArray; -import org.json.simple.JSONObject; - -import java.util.ArrayList; -import java.util.List; -import java.util.random.RandomGenerator; - -import com.dfsek.terra.api.Platform; -import com.dfsek.terra.api.inventory.ItemStack; -import com.dfsek.terra.api.util.collection.ProbabilityCollection; - - -/** - * Representation of a Loot Table pool, or a set of items to be fetched independently. - */ -public class Pool { - private final int max; - private final int min; - private final ProbabilityCollection entries; - - /** - * Instantiates a Pool from a JSON representation. - * - * @param pool The JSON Object to instantiate from. - */ - public Pool(JSONObject pool, Platform platform) { - entries = new ProbabilityCollection<>(); - Object amount = pool.get("rolls"); - if(amount instanceof Long) { - max = FastMath.toIntExact((Long) amount); - min = FastMath.toIntExact((Long) amount); - } else { - max = FastMath.toIntExact((Long) ((JSONObject) amount).get("max")); - min = FastMath.toIntExact((Long) ((JSONObject) amount).get("min")); - } - - for(Object entryJSON : (JSONArray) pool.get("entries")) { - Entry entry = new Entry((JSONObject) entryJSON, platform); - entries.add(entry, FastMath.toIntExact(entry.getWeight())); - } - } - - /** - * Fetches a list of items from the pool using the provided RandomGenerator instance. - * - * @param r The RandomGenerator instance to use. - * - * @return List<ItemStack> - The list of items fetched. - */ - public List getItems(RandomGenerator r) { - - int rolls = r.nextInt(max - min + 1) + min; - List items = new ArrayList<>(); - for(int i = 0; i < rolls; i++) { - items.add(entries.get(r).getItem(r)); - } - return items; - } -} diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/AmountFunction.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/AmountFunction.java deleted file mode 100644 index 8461dc623..000000000 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/AmountFunction.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.structure.structures.loot.functions; - - -import java.util.random.RandomGenerator; - -import com.dfsek.terra.api.inventory.ItemStack; - - -/** - * Loot LootFunction fot setting the amount of an item. - */ -public class AmountFunction implements LootFunction { - private final int max; - private final int min; - - /** - * Instantiates an AmountFunction. - * - * @param min Minimum amount. - * @param max Maximum amount. - */ - public AmountFunction(int min, int max) { - this.min = min; - this.max = max; - } - - /** - * Applies the function to an ItemStack. - * - * @param original The ItemStack on which to apply the function. - * @param r The RandomGenerator instance to use. - * - * @return - ItemStack - The mutated ItemStack. - */ - @Override - public ItemStack apply(ItemStack original, RandomGenerator r) { - original.setAmount(r.nextInt(max - min + 1) + min); - return original; - } -} diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/DamageFunction.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/DamageFunction.java deleted file mode 100644 index cd9664770..000000000 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/DamageFunction.java +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.structure.structures.loot.functions; - -import java.util.random.RandomGenerator; - -import com.dfsek.terra.api.inventory.ItemStack; -import com.dfsek.terra.api.inventory.item.Damageable; -import com.dfsek.terra.api.inventory.item.ItemMeta; - - -/** - * Loot LootFunction for setting the damage on items in Loot Tables - */ -public class DamageFunction implements LootFunction { - private final int max; - private final int min; - - /** - * Instantiates a DamageFunction. - * - * @param min Minimum amount of damage (percentage, out of 100) - * @param max Maximum amount of damage (percentage, out of 100) - */ - public DamageFunction(int min, int max) { - this.min = min; - this.max = max; - } - - /** - * Applies the function to an ItemStack. - * - * @param original The ItemStack on which to apply the function. - * @param r The RandomGenerator instance to use. - * - * @return - ItemStack - The mutated ItemStack. - */ - @Override - public ItemStack apply(ItemStack original, RandomGenerator r) { - if(original == null) return null; - if(!original.isDamageable()) return original; - ItemMeta meta = original.getItemMeta(); - double itemDurability = (r.nextDouble() * (max - min)) + min; - Damageable damage = (Damageable) meta; - damage.setDamage((int) (original.getType().getMaxDurability() - (itemDurability / 100) * original.getType().getMaxDurability())); - original.setItemMeta((ItemMeta) damage); - return original; - } -} diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/EnchantFunction.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/EnchantFunction.java deleted file mode 100644 index 4e54941ba..000000000 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/EnchantFunction.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.structure.structures.loot.functions; - -import net.jafama.FastMath; -import org.json.simple.JSONArray; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.random.RandomGenerator; - -import com.dfsek.terra.api.Platform; -import com.dfsek.terra.api.inventory.ItemStack; -import com.dfsek.terra.api.inventory.item.Enchantment; -import com.dfsek.terra.api.inventory.item.ItemMeta; - - -public class EnchantFunction implements LootFunction { - private static final Logger LOGGER = LoggerFactory.getLogger(EnchantFunction.class); - private final int min; - private final int max; - private final JSONArray disabled; - private final Platform platform; - - - public EnchantFunction(int min, int max, JSONArray disabled, Platform platform) { - this.max = max; - this.min = min; - this.disabled = disabled; - this.platform = platform; - } - - /** - * Applies the function to an ItemStack. - * - * @param original The ItemStack on which to apply the function. - * @param r The RandomGenerator instance to use. - * - * @return - ItemStack - The mutated ItemStack. - */ - @Override - public ItemStack apply(ItemStack original, RandomGenerator r) { - if(original.getItemMeta() == null) return original; - - double enchant = (r.nextDouble() * (max - min)) + min; - List possible = new ArrayList<>(); - for(Enchantment ench : platform.getItemHandle().getEnchantments()) { - if(ench.canEnchantItem(original) && (disabled == null || !this.disabled.contains(ench.getID()))) { - possible.add(ench); - } - } - int numEnchant = (r.nextInt((int) FastMath.abs(enchant)) / 10 + 1); - Collections.shuffle(possible); - ItemMeta meta = original.getItemMeta(); - iter: - for(int i = 0; i < numEnchant && i < possible.size(); i++) { - Enchantment chosen = possible.get(i); - for(Enchantment ench : meta.getEnchantments().keySet()) { - if(chosen.conflictsWith(ench)) continue iter; - } - int lvl = r.nextInt(1 + (int) (((enchant / 40 > 1) ? 1 : enchant / 40) * (chosen.getMaxLevel()))); - try { - meta.addEnchantment(chosen, FastMath.max(lvl, 1)); - } catch(IllegalArgumentException e) { - LOGGER.warn( - "Attempted to enchant {} with {} at level {}, but an unexpected exception occurred! Usually this is caused by a " + - "misbehaving enchantment plugin.", - original.getType(), chosen, FastMath.max(lvl, 1)); - } - } - original.setItemMeta(meta); - return original; - } -} diff --git a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/LootFunction.java b/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/LootFunction.java deleted file mode 100644 index adce098a7..000000000 --- a/common/addons/config-structure/src/main/java/com/dfsek/terra/addons/structure/structures/loot/functions/LootFunction.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.structure.structures.loot.functions; - - -import java.util.random.RandomGenerator; - -import com.dfsek.terra.api.inventory.ItemStack; - - -/** - * Interface for mutating items in Loot Tables. - */ -public interface LootFunction { - /** - * Applies the function to an ItemStack. - * - * @param original The ItemStack on which to apply the function. - * @param r The RandomGenerator instance to use. - * - * @return - ItemStack - The mutated ItemStack. - */ - ItemStack apply(ItemStack original, RandomGenerator r); -} diff --git a/common/addons/language-yaml/build.gradle.kts b/common/addons/language-yaml/build.gradle.kts index bb180dae9..88b5ccfcf 100644 --- a/common/addons/language-yaml/build.gradle.kts +++ b/common/addons/language-yaml/build.gradle.kts @@ -1,6 +1,6 @@ version = version("1.0.0") dependencies { - implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}") + implementation(libs.libraries.tectonic.yaml) compileOnlyApi(project(":common:addons:manifest-addon-loader")) } diff --git a/common/addons/manifest-addon-loader/build.gradle.kts b/common/addons/manifest-addon-loader/build.gradle.kts index 6a5b6f54e..1964188ff 100644 --- a/common/addons/manifest-addon-loader/build.gradle.kts +++ b/common/addons/manifest-addon-loader/build.gradle.kts @@ -1,8 +1,8 @@ version = version("1.0.0") dependencies { - api("commons-io:commons-io:2.7") - implementation("com.dfsek.tectonic:yaml:${Versions.Libraries.tectonic}") + api(libs.libraries.internal.apache.io) + implementation(libs.libraries.tectonic.yaml) } tasks.withType { diff --git a/common/addons/structure-terrascript-loader/build.gradle.kts b/common/addons/structure-terrascript-loader/build.gradle.kts index 18d4019b9..579b2c964 100644 --- a/common/addons/structure-terrascript-loader/build.gradle.kts +++ b/common/addons/structure-terrascript-loader/build.gradle.kts @@ -1,15 +1,6 @@ -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar - version = version("1.1.0") dependencies { - api("commons-io:commons-io:2.7") compileOnlyApi(project(":common:addons:manifest-addon-loader")) - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("org.apache.commons", "com.dfsek.terra.addons.terrascript.lib.commons") - relocate("net.jafama", "com.dfsek.terra.addons.terrascript.lib.jafama") + api(libs.libraries.internal.apache.io) } \ No newline at end of file diff --git a/common/addons/terrascript-function-check-noise-3d/build.gradle.kts b/common/addons/terrascript-function-check-noise-3d/build.gradle.kts index 51bb33cf6..9b35e7ea0 100644 --- a/common/addons/terrascript-function-check-noise-3d/build.gradle.kts +++ b/common/addons/terrascript-function-check-noise-3d/build.gradle.kts @@ -4,11 +4,4 @@ dependencies { compileOnlyApi(project(":common:addons:manifest-addon-loader")) compileOnlyApi(project(":common:addons:chunk-generator-noise-3d")) compileOnlyApi(project(":common:addons:structure-terrascript-loader")) - - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) - testImplementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) -} - -tasks.named("shadowJar") { - relocate("net.jafama", "com.dfsek.terra.addon.terrascript.check.lib.jafama") } diff --git a/common/api/build.gradle.kts b/common/api/build.gradle.kts index b82c614ed..d6b54518a 100644 --- a/common/api/build.gradle.kts +++ b/common/api/build.gradle.kts @@ -1,14 +1,16 @@ dependencies { - api("ca.solo-studios", "strata", Versions.Libraries.strata) - compileOnlyApi("org.slf4j", "slf4j-api", Versions.Libraries.slf4j) - testImplementation("org.slf4j", "slf4j-api", Versions.Libraries.slf4j) - api("cloud.commandframework", "cloud-core", Versions.Libraries.cloud) + api(libs.libraries.strata) + compileOnlyApi(libs.libraries.slf4j.api) + testImplementation(libs.libraries.slf4j.api) + api(libs.libraries.cloud.core) - api("com.dfsek.tectonic", "common", Versions.Libraries.tectonic) + api(libs.libraries.tectonic) - api("com.github.ben-manes.caffeine", "caffeine", Versions.Libraries.caffeine) + api(libs.libraries.caffeine) - api("io.vavr", "vavr", Versions.Libraries.vavr) + api(libs.libraries.vavr) - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) + api(libs.libraries.jafama) + + api(libs.libraries.paralithic) } \ No newline at end of file diff --git a/common/implementation/base/build.gradle.kts b/common/implementation/base/build.gradle.kts index 1910484f0..a6d9bd1ac 100644 --- a/common/implementation/base/build.gradle.kts +++ b/common/implementation/base/build.gradle.kts @@ -2,14 +2,14 @@ dependencies { api(project(":common:api")) api(project(":common:implementation:bootstrap-addon-loader")) - testImplementation("org.slf4j", "slf4j-api", Versions.Libraries.slf4j) + testImplementation(libs.libraries.slf4j.api) - implementation("commons-io", "commons-io", Versions.Libraries.Internal.apacheIO) + implementation(libs.libraries.internal.apache.io) - implementation("org.apache.commons", "commons-text", Versions.Libraries.Internal.apacheText) - implementation("com.dfsek.tectonic", "yaml", Versions.Libraries.tectonic) + implementation(libs.libraries.internal.apache.text) + implementation(libs.libraries.tectonic.yaml) - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) + implementation(libs.libraries.jafama) - implementation("com.dfsek", "paralithic", Versions.Libraries.paralithic) + implementation(libs.libraries.paralithic) } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml new file mode 100644 index 000000000..03bcac999 --- /dev/null +++ b/gradle/libs.versions.toml @@ -0,0 +1,98 @@ +[versions] +libraries_tectonic = "4.2.0" +libraries_paralithic = "0.7.0" +libraries_strata = "1.3.1" +libraries_snakeyaml = "1.30" +libraries_cloud = "1.7.0" +libraries_slf4j = "1.7.36" +libraries_caffeine = "3.1.1" +libraries_vavr = "0.10.4" +libraries_jafama = "2.3.2" +libraries_guava = "31.1-jre" + +libraries_internal_apache-text = "1.9" +libraries_internal_apache-io = "2.11.0" +libraries_internal_fastutil = "8.5.8" +libraries_internal_shadow = "7.1.2" +libraries_internal_junit-jupiter = "5.9.0" +libraries_internal_jetbrains-annotations = "23.0.0" +libraries_internal_asm = "9.3" + +mod_mixin = "0.11.4+mixin.0.8.5" +mod_minecraft = "1.19.2" +mod_yarn = "1.19.2+build.4" +mod_architecury-loom = "0.12.0.299" +mod_architectury-plugin = "3.4.138" +mod_loom-quiltflower = "1.7.3" +mod_lazy-dfu = "0.1.3" + +mod_fabric_fabric-loader = "0.14.9" +mod_fabric_fabric-api = "0.60.0+1.19.2" + +mod_quilt_quilt-loader = "0.17.3" +mod_quilt_fabric-api = "4.0.0-beta.9+0.60.0-1.19.2" + +mod_forge_forge = "1.19.2-43.1.1" +mod_forge_burningwave = "12.59.0" + +bukkit_run-paper = "1.0.6" +bukkit_paperweight = "1.3.8" +bukkit_paper = "1.19-R0.1-20220725.172700-79" +bukkit_paper-lib = "1.0.7" +bukkit_minecraft = "1.19.2" +bukkit_reflection-remapper = "0.1.0-20220312.202611-7" + +cli_nbt = "6.1" +cli_logback = "1.2.11" + +[libraries] +libraries_tectonic = { module = "com.dfsek.tectonic:common", version.ref = "libraries_tectonic" } +libraries_tectonic_yaml = { module = "com.dfsek.tectonic:yaml", version.ref = "libraries_tectonic" } +libraries_paralithic = { module = "com.dfsek:paralithic", version.ref = "libraries_paralithic" } +libraries_strata = { module = "ca.solo-studios:strata", version.ref = "libraries_strata" } +libraries_snakeyaml = { module = "org.yaml:snakeyaml", version.ref = "libraries_snakeyaml" } +libraries_cloud-core = { module = "cloud.commandframework:cloud-core", version.ref = "libraries_cloud" } +libraries_slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "libraries_slf4j" } +libraries_caffeine = { module = "com.github.ben-manes.caffeine:caffeine", version.ref = "libraries_caffeine" } +libraries_vavr = { module = "io.vavr:vavr", version.ref = "libraries_vavr" } +libraries_guava = { module = "com.google.guava:guava", version.ref = "libraries_guava" } +libraries_jafama = { module = "net.jafama:jafama", version.ref = "libraries_jafama" } + +libraries_internal_apache-text = { module = "org.apache.commons:commons-text", version.ref = "libraries_internal_apache-text" } +libraries_internal_apache-io = { module = "commons-io:commons-io", version.ref = "libraries_internal_apache-io" } +libraries_internal_fastutil = { module = "it.unimi.dsi:fastutil ", version.ref = "libraries_internal_fastutil" } +libraries_internal_shadow = { module = "gradle.plugin.com.github.johnrengelman:shadow", version.ref = "libraries_internal_shadow" } +libraries_internal_junit-jupiter-api = { module = "org.junit.jupiter:junit-jupiter-api", version.ref = "libraries_internal_junit_jupiter" } +libraries_internal_junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "libraries_internal_junit_jupiter" } +libraries_internal_jetbrains-annotations = { module = "org.jetbrains:annotations", version.ref = "libraries_internal_jetbrains_annotations" } +libraries_internal_asm = { module = "org.ow2.asm:asm", version.ref = "libraries_internal_asm" } +libraries_internal_asm-tree = { module = "org.ow2.asm:asm-tree", version.ref = "libraries_internal_asm" } + +mod_mixin = { module = "net.fabricmc:sponge-mixin", version.ref = "mod_mixin" } +mod_minecraft = { module = "com.mojang:minecraft", version.ref = "mod_minecraft" } +mod_lazy-dfu = { module = "maven.modrinth:lazydfu", version.ref = "mod_lazy-dfu" } +mod_cloud-fabric = { module = "cloud.commandframework:cloud-fabric", version.ref = "libraries_cloud" } + +mod_fabric_fabric-loader = { module = "net.fabricmc:fabric-loader", version.ref = "mod_fabric_fabric-loader" } + +mod_quilt_quilt-loader = { module = "org.quiltmc:quilt-loader", version.ref = "mod_quilt_quilt-loader" } +mod_quilt_fabric-api = { module = "org.quiltmc.quilted-fabric-api:quilted-fabric-api", version.ref = "mod_quilt_fabric-api" } + +mod_forge_forge = { module = "net.minecraftforge:forge", version.ref = "mod_forge_forge" } +mod_forge_burningwave = { module = "org.burningwave:core", version.ref = "mod_forge_burningwave" } + +bukkit_paper-api = { module = "io.papermc.paper:paper-api", version.ref = "bukkit_paper" } +bukkit_paper-lib = { module = "io.papermc:paperlib", version.ref = "bukkit_paper-lib" } +bukkit_reflection-remapper = { module = "xyz.jpenilla:reflection-remapper", version.ref = "bukkit_reflection-remapper" } +bukkit_cloud-paper = { module = "cloud.commandframework:cloud-paper", version.ref = "libraries_cloud" } + +cli_nbt = { module = "com.github.Querz:NBT", version.ref = "cli_nbt" } +cli_logback = { module = "ch.qos.logback:logback-classic", version.ref = "cli_logback" } + +[plugins] +mod_architectury-loom = { id = "dev.architectury.loom", version.ref = "mod_architecury-loom" } +mod_architectury-plugin = { id = "architectury-plugin", version.ref = "mod_architectury-plugin" } +mod_loom-quiltflower = { id = "io.github.juuxel.loom-quiltflower", version.ref = "mod_loom-quiltflower" } + +bukkit_run-paper = { id = "xyz.jpenilla.run-paper", version.ref = "bukkit_run-paper" } +bukkit_paperweight = { id = "io.papermc.paperweight.userdev", version.ref = "bukkit_paperweight" } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index e708b1c023ec8b20f512888fe07c5bd3ff77bb8f..41d9927a4d4fb3f96a785543079b8df6723c946b 100644 GIT binary patch delta 20926 zcmY(p19zBh*tDC*wr$(CZQHhW$3|n@W@Fn%V>fmhHTa(WuDw3|hwGe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L6bOcKu7F0Ila_fDJz|V@?;)@(0)E41rXCP-$KcX!i%hgRg)C3v}Rz zc^IG@L{Qnl{dpY#@*6mq3I`{`SbyaL#w@^qGz`(?89_^MKmz+%qS_xxO+>86&{6-L zWKlROiqOde`hJ!G1RfE^?$4?~Pb^U^OJMjl8lb@<40s<;H036FODHZ~?mK1@#e1dqL7-fvm zbFLWt@LU!YT}A>VB}7ofvNUk=f+#L7D*_uYiP3sr(-VTzfzB&1K(T^o;;P~xnuKcp zolHn2p%Vcz;l+XBb}+e15cI$!frVazhyYs#{yQM!co;x70Pf+PfQdoSVpSd#nScuZ w|E&DqkiEp6nWHb}B;da$<=?F+{O4J~(cC2_GD0yC1R_ni)(HQ!%J47kKb!F!p8x;= diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 3e7c5fc21..ae04661ee 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -org.gradle.jvmargs=-Xmx4096m \ No newline at end of file diff --git a/gradlew b/gradlew index 4f906e0c8..1b6c78733 100755 --- a/gradlew +++ b/gradlew @@ -1,7 +1,7 @@ -#!/usr/bin/env sh +#!/bin/sh # -# Copyright 2015 the original author or authors. +# Copyright © 2015-2021 the original authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,67 +17,101 @@ # ############################################################################## -## -## Gradle start up script for UN*X -## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# ############################################################################## # Attempt to set APP_HOME + # Resolve links: $0 may be a link -PRG="$0" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*' > /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/" >/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED" >/dev/null + +APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit APP_NAME="Gradle" -APP_BASE_NAME=`basename "$0"` +APP_BASE_NAME=${0##*/} # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' # Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" +MAX_FD=maximum warn () { echo "$*" -} +} >&2 die () { echo echo "$*" echo exit 1 -} +} >&2 # OS specific support (must be 'true' or 'false'). cygwin=false msys=false darwin=false nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; esac CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar @@ -87,9 +121,9 @@ CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar if [ -n "$JAVA_HOME" ] ; then if [ -x "$JAVA_HOME/jre/sh/java" ] ; then # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" + JAVACMD=$JAVA_HOME/jre/sh/java else - JAVACMD="$JAVA_HOME/bin/java" + JAVACMD=$JAVA_HOME/bin/java fi if [ ! -x "$JAVACMD" ] ; then die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME @@ -98,7 +132,7 @@ Please set the JAVA_HOME variable in your environment to match the location of your Java installation." fi else - JAVACMD="java" + JAVACMD=java which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. Please set the JAVA_HOME variable in your environment to match the @@ -106,80 +140,95 @@ location of your Java installation." fi # Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin or MSYS, switch paths to Windows format before running java -if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=`expr $i + 1` - done - case $i in - 0) set -- ;; - 1) set -- "$args0" ;; - 2) set -- "$args0" "$args1" ;; - 3) set -- "$args0" "$args1" "$args2" ;; - 4) set -- "$args0" "$args1" "$args2" "$args3" ;; - 5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - 6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - 7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - 8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - 9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" esac fi -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=`save "$@"` +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + +# Collect all arguments for the java command; +# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of +# shell script including quotes and variable substitutions, so put them in +# double quotes to make sure that they get re-expanded; and +# * put everything else in single quotes, so that it's not re-expanded. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' exec "$JAVACMD" "$@" diff --git a/platforms/bukkit/build.gradle.kts b/platforms/bukkit/build.gradle.kts index 8a00fd79d..d157f6a43 100644 --- a/platforms/bukkit/build.gradle.kts +++ b/platforms/bukkit/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("xyz.jpenilla.run-paper") version "1.0.6" + alias(libs.plugins.bukkit.run.paper) } repositories { @@ -9,15 +9,12 @@ repositories { dependencies { shaded(project(":platforms:bukkit:common")) shaded(project(":platforms:bukkit:nms:v1_19_R1", configuration = "reobf")) - shaded("xyz.jpenilla", "reflection-remapper", Versions.Bukkit.reflectionRemapper) + shaded(libs.bukkit.reflection.remapper) } tasks { shadowJar { - relocate("org.bstats.bukkit", "com.dfsek.terra.lib.bstats") relocate("io.papermc.lib", "com.dfsek.terra.lib.paperlib") - relocate("com.google.common", "com.dfsek.terra.lib.google.common") - relocate("org.apache.logging.slf4j", "com.dfsek.terra.lib.slf4j-over-log4j") exclude("org/slf4j/**") exclude("org/checkerframework/**") exclude("org/jetbrains/annotations/**") @@ -28,7 +25,7 @@ tasks { } runServer { - minecraftVersion("1.19") + minecraftVersion(libs.versions.bukkit.minecraft.get()) dependsOn(shadowJar) pluginJars(shadowJar.get().archiveFile) } diff --git a/platforms/bukkit/common/build.gradle.kts b/platforms/bukkit/common/build.gradle.kts index a806ce672..7f25f1288 100644 --- a/platforms/bukkit/common/build.gradle.kts +++ b/platforms/bukkit/common/build.gradle.kts @@ -5,14 +5,9 @@ repositories { dependencies { shadedApi(project(":common:implementation:base")) - api("org.slf4j:slf4j-api:1.8.0-beta4") { - because("Minecraft 1.17+ includes slf4j 1.8.0-beta4, so we need to shade it for other versions.") - } + compileOnly(libs.bukkit.paper.api) - compileOnly("io.papermc.paper:paper-api:${Versions.Bukkit.paper}") + shadedApi(libs.bukkit.paper.lib) - shadedApi("io.papermc", "paperlib", Versions.Bukkit.paperLib) - shadedApi("com.google.guava:guava:30.0-jre") - - shadedApi("cloud.commandframework", "cloud-paper", Versions.Libraries.cloud) + shadedApi(libs.bukkit.cloud.paper) } diff --git a/platforms/bukkit/nms/v1_19_R1/build.gradle.kts b/platforms/bukkit/nms/v1_19_R1/build.gradle.kts index e40d548dc..cb17adc76 100644 --- a/platforms/bukkit/nms/v1_19_R1/build.gradle.kts +++ b/platforms/bukkit/nms/v1_19_R1/build.gradle.kts @@ -1,4 +1,6 @@ -apply(plugin = "io.papermc.paperweight.userdev") +plugins { + alias(libs.plugins.bukkit.paperweight) +} repositories { maven("https://s01.oss.sonatype.org/content/repositories/snapshots/") diff --git a/platforms/cli/build.gradle.kts b/platforms/cli/build.gradle.kts index e273422af..fc22547e9 100644 --- a/platforms/cli/build.gradle.kts +++ b/platforms/cli/build.gradle.kts @@ -7,14 +7,10 @@ val javaMainClass = "com.dfsek.terra.cli.TerraCLI" dependencies { shadedApi(project(":common:implementation:base")) - shadedApi("commons-io:commons-io:${Versions.CLI.commonsIO}") - shadedApi("com.github.Querz:NBT:${Versions.CLI.nbt}") + shadedApi(libs.libraries.internal.apache.io) + shadedApi(libs.cli.nbt) - shadedImplementation("com.google.guava:guava:${Versions.CLI.guava}") - - shadedImplementation("ch.qos.logback:logback-classic:${Versions.CLI.logback}") - - implementation("net.jafama", "jafama", Versions.Libraries.Internal.jafama) + shadedImplementation(libs.cli.logback) } tasks.withType { diff --git a/platforms/fabric/build.gradle.kts b/platforms/fabric/build.gradle.kts index 2a20545a2..380d65c2b 100644 --- a/platforms/fabric/build.gradle.kts +++ b/platforms/fabric/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("dev.architectury.loom") version Versions.Mod.architecuryLoom - id("architectury-plugin") version Versions.Mod.architecturyPlugin - id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower + alias(libs.plugins.mod.architectury.loom) + alias(libs.plugins.mod.architectury.plugin) + alias(libs.plugins.mod.loom.quiltflower) } architectury { @@ -12,9 +12,6 @@ architectury { dependencies { shadedApi(project(":common:implementation:base")) - annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}") - annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}") - implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false } "developmentFabric"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false } shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionFabric")) { isTransitive = false } @@ -22,28 +19,15 @@ dependencies { "developmentFabric"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false } shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionFabric")) { isTransitive = false } + minecraft(libs.mod.minecraft) + mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2") - minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}") - mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2") + modImplementation(libs.mod.fabric.fabric.loader) - modImplementation("net.fabricmc:fabric-loader:${Versions.Fabric.fabricLoader}") + modImplementation(libs.mod.cloud.fabric) + include(libs.mod.cloud.fabric) - setOf( - "fabric-lifecycle-events-v1", - "fabric-resource-loader-v0", - "fabric-api-base", - "fabric-command-api-v2", - "fabric-networking-api-v1" - ).forEach { apiModule -> - val module = fabricApi.module(apiModule, Versions.Fabric.fabricAPI) - modImplementation(module) - include(module) - } - - modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) - include("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) - - modLocalRuntime("com.github.astei:lazydfu:${Versions.Mod.lazyDfu}") + modLocalRuntime(libs.mod.lazy.dfu) } loom { diff --git a/platforms/forge/build.gradle.kts b/platforms/forge/build.gradle.kts index 7cfddab1d..adf563834 100644 --- a/platforms/forge/build.gradle.kts +++ b/platforms/forge/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("dev.architectury.loom") version Versions.Mod.architecuryLoom - id("architectury-plugin") version Versions.Mod.architecturyPlugin - id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower + alias(libs.plugins.mod.architectury.loom) + alias(libs.plugins.mod.architectury.plugin) + alias(libs.plugins.mod.loom.quiltflower) } architectury { @@ -10,9 +10,6 @@ architectury { } dependencies { - annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}") - annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}") - shadedApi(project(":common:implementation:base")) "forgeRuntimeLibrary"(project(":common:implementation:base")) @@ -20,14 +17,14 @@ dependencies { "developmentForge"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false } shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionForge")) { isTransitive = false } - forge(group = "net.minecraftforge", name = "forge", version = Versions.Forge.forge) + forge(libs.mod.forge.forge) - minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}") - mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2") + minecraft(libs.mod.minecraft) + mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2") //forge is not ok. - compileOnly("org.burningwave:core:${Versions.Forge.burningwave}") - "forgeRuntimeLibrary"("org.burningwave:core:${Versions.Forge.burningwave}") + compileOnly(libs.mod.forge.burningwave) + "forgeRuntimeLibrary"(libs.mod.forge.burningwave) } loom { diff --git a/platforms/mixin-common/build.gradle.kts b/platforms/mixin-common/build.gradle.kts index b293f3cfa..d57c4b00d 100644 --- a/platforms/mixin-common/build.gradle.kts +++ b/platforms/mixin-common/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("dev.architectury.loom") version Versions.Mod.architecuryLoom - id("architectury-plugin") version Versions.Mod.architecturyPlugin - id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower + alias(libs.plugins.mod.architectury.loom) + alias(libs.plugins.mod.architectury.plugin) + alias(libs.plugins.mod.loom.quiltflower) } loom { @@ -15,16 +15,14 @@ loom { dependencies { shadedApi(project(":common:implementation:base")) - compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}") - annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}") - annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}") + modImplementation(libs.mod.fabric.fabric.loader) - minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}") - mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2") + minecraft(libs.mod.minecraft) + mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2") } architectury { common("fabric", "forge", "quilt") - minecraft = Versions.Mod.minecraft + minecraft = libs.versions.mod.minecraft.get() } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java index 03a7c8f6f..0130d8112 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/generation/MinecraftChunkGeneratorWrapper.java @@ -147,7 +147,7 @@ public class MinecraftChunkGeneratorWrapper extends net.minecraft.world.gen.chun private void beard(StructureAccessor structureAccessor, Chunk chunk, WorldProperties world, BiomeProvider biomeProvider, PreLoadCompatibilityOptions compatibilityOptions) { - StructureWeightSampler structureWeightSampler = StructureWeightSampler.method_42695(structureAccessor, chunk.getPos()); + StructureWeightSampler structureWeightSampler = StructureWeightSampler.createStructureWeightSampler(structureAccessor, chunk.getPos()); double threshold = compatibilityOptions.getBeardThreshold(); double airThreshold = compatibilityOptions.getAirThreshold(); int xi = chunk.getPos().x << 4; diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/access/BiomeAccessor.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/access/BiomeAccessor.java deleted file mode 100644 index c51029682..000000000 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/access/BiomeAccessor.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.dfsek.terra.mod.mixin.access; - -import net.minecraft.world.biome.Biome; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.gen.Accessor; - - -@Mixin(Biome.class) -public interface BiomeAccessor { - @Accessor("weather") - Biome.Weather getWeather(); -} diff --git a/platforms/mixin-common/src/main/resources/terra.accesswidener b/platforms/mixin-common/src/main/resources/terra.accesswidener index 4f59bb962..dfde67a12 100644 --- a/platforms/mixin-common/src/main/resources/terra.accesswidener +++ b/platforms/mixin-common/src/main/resources/terra.accesswidener @@ -1,2 +1 @@ -accessWidener v1 named -accessible class net/minecraft/world/biome/Biome$Weather \ No newline at end of file +accessWidener v1 named \ No newline at end of file diff --git a/platforms/mixin-lifecycle/build.gradle.kts b/platforms/mixin-lifecycle/build.gradle.kts index e8b852dc5..a645777fc 100644 --- a/platforms/mixin-lifecycle/build.gradle.kts +++ b/platforms/mixin-lifecycle/build.gradle.kts @@ -1,22 +1,22 @@ plugins { - id("dev.architectury.loom") version Versions.Mod.architecuryLoom - id("architectury-plugin") version Versions.Mod.architecturyPlugin - id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower + alias(libs.plugins.mod.architectury.loom) + alias(libs.plugins.mod.architectury.plugin) + alias(libs.plugins.mod.loom.quiltflower) } dependencies { shadedApi(project(":common:implementation:base")) - compileOnly("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}") - annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}") - annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}") - implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false } - minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}") - mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2") + shadedApi(project(":common:implementation:base")) - modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) { + modImplementation(libs.mod.fabric.fabric.loader) + + minecraft(libs.mod.minecraft) + mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2") + + modImplementation(libs.mod.cloud.fabric) { exclude("net.fabricmc") exclude("net.fabricmc.fabric-api") } @@ -42,5 +42,5 @@ tasks { architectury { common("fabric", "quilt") - minecraft = Versions.Mod.minecraft + minecraft = libs.versions.mod.minecraft.get() } \ No newline at end of file diff --git a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java index 3f53bfdfb..ed16b4da9 100644 --- a/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java +++ b/platforms/mixin-lifecycle/src/main/java/com/dfsek/terra/lifecycle/LifecycleEntryPoint.java @@ -16,15 +16,19 @@ public class LifecycleEntryPoint { protected static void initialize(String modName, LifecyclePlatform platform) { logger.info("Initializing Terra {} mod...", modName); - FabricServerCommandManager manager = new FabricServerCommandManager<>( - CommandExecutionCoordinator.simpleCoordinator(), - serverCommandSource -> (CommandSender) serverCommandSource, - commandSender -> (ServerCommandSource) commandSender - ); - - - manager.brigadierManager().setNativeNumberSuggestions(false); - - platform.getEventManager().callEvent(new CommandRegistrationEvent(manager)); + try { + FabricServerCommandManager manager = new FabricServerCommandManager<>( + CommandExecutionCoordinator.simpleCoordinator(), + serverCommandSource -> (CommandSender) serverCommandSource, + commandSender -> (ServerCommandSource) commandSender + ); + + + manager.brigadierManager().setNativeNumberSuggestions(false); + + platform.getEventManager().callEvent(new CommandRegistrationEvent(manager)); + } catch (Exception e) { + logger.warn("Fabric API not found, Terra commands will not work."); + } } } diff --git a/platforms/quilt/build.gradle.kts b/platforms/quilt/build.gradle.kts index 38ddaaae6..c8a2dbefb 100644 --- a/platforms/quilt/build.gradle.kts +++ b/platforms/quilt/build.gradle.kts @@ -1,7 +1,7 @@ plugins { - id("dev.architectury.loom") version Versions.Mod.architecuryLoom - id("architectury-plugin") version Versions.Mod.architecturyPlugin - id("io.github.juuxel.loom-quiltflower") version Versions.Mod.loomQuiltflower + alias(libs.plugins.mod.architectury.loom) + alias(libs.plugins.mod.architectury.plugin) + alias(libs.plugins.mod.loom.quiltflower) } architectury { @@ -12,9 +12,6 @@ architectury { dependencies { shadedApi(project(":common:implementation:base")) - annotationProcessor("net.fabricmc:sponge-mixin:${Versions.Mod.mixin}") - annotationProcessor("dev.architectury:architectury-loom:${Versions.Mod.architecuryLoom}") - implementation(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false } "developmentQuilt"(project(path = ":platforms:mixin-common", configuration = "namedElements")) { isTransitive = false } shaded(project(path = ":platforms:mixin-common", configuration = "transformProductionQuilt")) { isTransitive = false } @@ -23,23 +20,22 @@ dependencies { "developmentQuilt"(project(path = ":platforms:mixin-lifecycle", configuration = "namedElements")) { isTransitive = false } shaded(project(path = ":platforms:mixin-lifecycle", configuration = "transformProductionQuilt")) { isTransitive = false } - minecraft("com.mojang:minecraft:${Versions.Mod.minecraft}") - mappings("net.fabricmc:yarn:${Versions.Mod.yarn}:v2") + minecraft(libs.mod.minecraft) + mappings("net.fabricmc", "yarn", libs.versions.mod.yarn.get(), classifier = "v2") - modImplementation("org.quiltmc:quilt-loader:${Versions.Quilt.quiltLoader}") + modImplementation(libs.mod.quilt.quilt.loader) + modImplementation(libs.mod.quilt.fabric.api) - modImplementation("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${Versions.Quilt.fabricApi}") - - modImplementation("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) { + modImplementation(libs.mod.cloud.fabric) { exclude("net.fabricmc") exclude("net.fabricmc.fabric-api") } - include("cloud.commandframework", "cloud-fabric", Versions.Libraries.cloud) { + include(libs.mod.cloud.fabric) { exclude("net.fabricmc") exclude("net.fabricmc.fabric-api") } - modLocalRuntime("com.github.astei:lazydfu:${Versions.Mod.lazyDfu}") { + modLocalRuntime(libs.mod.lazy.dfu) { exclude("net.fabricmc") exclude("net.fabricmc.fabric-api") } diff --git a/settings.gradle.kts b/settings.gradle.kts index 7a1cdc8a0..231cc5007 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -24,6 +24,7 @@ include(":platforms:bukkit:common") pluginManagement { repositories { + mavenCentral() gradlePluginPortal() maven("https://maven.fabricmc.net") { name = "Fabric Maven" @@ -37,5 +38,8 @@ pluginManagement { maven("https://maven.quiltmc.org/repository/release/") { name = "Quilt" } + maven("https://papermc.io/repo/repository/maven-public/") { + name = "PaperMC" + } } } From b5d081fde4b752095d89889d56d4beca528c985c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sun, 21 Aug 2022 14:29:57 -0500 Subject: [PATCH 10/11] remove more random --- .../structure/StructureCommandAddon.java | 3 +- .../feature/distributor/DistributorAddon.java | 7 +- ...PaddedGridSamplerDistributorTemplate.java} | 11 +- .../distributors/PaddedGridDistributor.java | 47 ----- .../PaddedGridSamplerDistributor.java | 36 ++++ .../addons/flora/flora/gen/TerraFlora.java | 4 +- .../addons/feature/locator/LocatorAddon.java | 8 - .../config/GaussianRandomLocatorTemplate.java | 39 ---- .../locator/config/RandomLocatorTemplate.java | 36 ---- .../locators/GaussianRandomLocator.java | 58 ------ .../locator/locators/RandomLocator.java | 53 ------ .../terra/addons/ore/ores/VanillaOre.java | 12 +- .../feature/FeatureGenerationStage.java | 4 +- .../shortcut/block/SingletonStructure.java | 2 +- .../structure/mutator/MutatedStructure.java | 4 +- .../terra/addons/sponge/SpongeStructure.java | 2 +- .../terrascript/script/StructureScript.java | 2 +- .../script/functions/LootFunction.java | 4 +- .../script/functions/StructureFunction.java | 2 +- .../dfsek/terra/api/structure/LootTable.java | 3 +- .../dfsek/terra/api/structure/Structure.java | 2 +- .../dfsek/terra/api/util/PopulationUtil.java | 39 ---- .../mod/mixin/gameplay/BoneMealTaskMixin.java | 4 +- .../terra/mod/util/FertilizableUtil.java | 4 +- .../mod/util/WritableWorldSeedRedirecter.java | 168 ++++++++++++++++++ 25 files changed, 236 insertions(+), 318 deletions(-) rename common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/config/{PaddedGridDistributorTemplate.java => PaddedGridSamplerDistributorTemplate.java} (64%) delete mode 100644 common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridDistributor.java create mode 100644 common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridSamplerDistributor.java delete mode 100644 common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/config/GaussianRandomLocatorTemplate.java delete mode 100644 common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/config/RandomLocatorTemplate.java delete mode 100644 common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/GaussianRandomLocator.java delete mode 100644 common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/RandomLocator.java delete mode 100644 common/api/src/main/java/com/dfsek/terra/api/util/PopulationUtil.java create mode 100644 platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/WritableWorldSeedRedirecter.java diff --git a/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java b/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java index 8b1dc67c9..7f3bab096 100644 --- a/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java +++ b/common/addons/command-structures/src/main/java/com/dfsek/terra/addons/commands/structure/StructureCommandAddon.java @@ -54,8 +54,7 @@ public class StructureCommandAddon implements MonadAddonInitializer { structure.generate( sender.position().toInt(), sender.world(), - context.get("rotation"), sender.world().getSeed() - ); + context.get("rotation")); }) .permission("terra.structures.generate") ); diff --git a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/DistributorAddon.java b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/DistributorAddon.java index 1b30b78d3..15a6af263 100644 --- a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/DistributorAddon.java +++ b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/DistributorAddon.java @@ -14,7 +14,7 @@ import java.util.function.Supplier; import com.dfsek.terra.addons.feature.distributor.config.AndDistributorTemplate; import com.dfsek.terra.addons.feature.distributor.config.NoDistributorTemplate; import com.dfsek.terra.addons.feature.distributor.config.OrDistributorTemplate; -import com.dfsek.terra.addons.feature.distributor.config.PaddedGridDistributorTemplate; +import com.dfsek.terra.addons.feature.distributor.config.PaddedGridSamplerDistributorTemplate; import com.dfsek.terra.addons.feature.distributor.config.PointSetDistributorTemplate; import com.dfsek.terra.addons.feature.distributor.config.SamplerDistributorTemplate; import com.dfsek.terra.addons.feature.distributor.config.XorDistributorTemplate; @@ -25,11 +25,8 @@ 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.api.Platform; -import com.dfsek.terra.api.addon.BaseAddon; import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent; import com.dfsek.terra.api.event.functional.FunctionalEventHandler; -import com.dfsek.terra.api.inject.annotations.Inject; import com.dfsek.terra.api.registry.CheckedRegistry; import com.dfsek.terra.api.structure.feature.Distributor; import com.dfsek.terra.api.util.function.monad.Monad; @@ -54,7 +51,7 @@ public class DistributorAddon implements MonadAddonInitializer { distributorRegistry.register(base.key("SAMPLER"), SamplerDistributorTemplate::new); distributorRegistry.register(base.key("POINTS"), PointSetDistributorTemplate::new); - distributorRegistry.register(base.key("PADDED_GRID"), PaddedGridDistributorTemplate::new); + distributorRegistry.register(base.key("PADDED_GRID_SAMPLER"), PaddedGridSamplerDistributorTemplate::new); distributorRegistry.register(base.key("AND"), AndDistributorTemplate::new); distributorRegistry.register(base.key("OR"), OrDistributorTemplate::new); distributorRegistry.register(base.key("XOR"), XorDistributorTemplate::new); diff --git a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/config/PaddedGridDistributorTemplate.java b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/config/PaddedGridSamplerDistributorTemplate.java similarity index 64% rename from common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/config/PaddedGridDistributorTemplate.java rename to common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/config/PaddedGridSamplerDistributorTemplate.java index ff77d18be..9af67d4b4 100644 --- a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/config/PaddedGridDistributorTemplate.java +++ b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/config/PaddedGridSamplerDistributorTemplate.java @@ -3,23 +3,24 @@ package com.dfsek.terra.addons.feature.distributor.config; import com.dfsek.tectonic.api.config.template.annotations.Value; import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; -import com.dfsek.terra.addons.feature.distributor.distributors.PaddedGridDistributor; +import com.dfsek.terra.addons.feature.distributor.distributors.PaddedGridSamplerDistributor; import com.dfsek.terra.api.config.meta.Meta; +import com.dfsek.terra.api.noise.NoiseSampler; import com.dfsek.terra.api.structure.feature.Distributor; -public class PaddedGridDistributorTemplate implements ObjectTemplate { +public class PaddedGridSamplerDistributorTemplate implements ObjectTemplate { @Value("width") private @Meta int width; @Value("padding") private @Meta int padding; - @Value("salt") - private @Meta int salt; + @Value("sampler") + private @Meta NoiseSampler noise; @Override public Distributor get() { - return new PaddedGridDistributor(width, padding, salt); + return new PaddedGridSamplerDistributor(noise, width, padding); } } diff --git a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridDistributor.java b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridDistributor.java deleted file mode 100644 index 444d2bc2f..000000000 --- a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridDistributor.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.dfsek.terra.addons.feature.distributor.distributors; - -import net.jafama.FastMath; - -import java.util.random.RandomGenerator; -import java.util.random.RandomGeneratorFactory; - -import com.dfsek.terra.api.structure.feature.Distributor; -import com.dfsek.terra.api.util.MathUtil; - - -public class PaddedGridDistributor implements Distributor { - private final int width; - - private final int cellWidth; - - private final int salt; - - public PaddedGridDistributor(int width, int padding, int salt) { - this.width = width; - this.salt = salt; - this.cellWidth = width + padding; - } - - private static long murmur64(long h) { - h ^= h >>> 33; - h *= 0xff51afd7ed558ccdL; - h ^= h >>> 33; - h *= 0xc4ceb9fe1a85ec53L; - h ^= h >>> 33; - return h; - } - - @Override - public boolean matches(int x, int z, long seed) { - int cellX = FastMath.floorDiv(x, cellWidth); - int cellZ = FastMath.floorDiv(z, cellWidth); - - RandomGenerator random = RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create( - (murmur64(MathUtil.squash(cellX, cellZ)) ^ seed) + salt); - - int pointX = random.nextInt(width) + cellX * cellWidth; - int pointZ = random.nextInt(width) + cellZ * cellWidth; - - return x == pointX && z == pointZ; - } -} diff --git a/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridSamplerDistributor.java b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridSamplerDistributor.java new file mode 100644 index 000000000..00f1e38e2 --- /dev/null +++ b/common/addons/config-distributors/src/main/java/com/dfsek/terra/addons/feature/distributor/distributors/PaddedGridSamplerDistributor.java @@ -0,0 +1,36 @@ +package com.dfsek.terra.addons.feature.distributor.distributors; + +import com.dfsek.terra.api.noise.NoiseSampler; + +import net.jafama.FastMath; + +import java.util.random.RandomGenerator; +import java.util.random.RandomGeneratorFactory; + +import com.dfsek.terra.api.structure.feature.Distributor; +import com.dfsek.terra.api.util.MathUtil; + + +public class PaddedGridSamplerDistributor implements Distributor { + private final NoiseSampler sampler; + private final int width; + + private final int cellWidth; + + public PaddedGridSamplerDistributor(NoiseSampler sampler, int width, int padding) { + this.sampler = sampler; + this.width = width; + this.cellWidth = width + padding; + } + + @Override + public boolean matches(int x, int z, long seed) { + int cellX = FastMath.floorDiv(x, cellWidth); + int cellZ = FastMath.floorDiv(z, cellWidth); + + int pointX = (int) (FastMath.round(MathUtil.lerp(MathUtil.inverseLerp(sampler.noise(x, z, seed), -1, 1), 0, width)) + cellX * cellWidth); + int pointZ = (int) (FastMath.round(MathUtil.lerp(MathUtil.inverseLerp(sampler.noise(x, z, seed + 1), -1, 1), 0, width)) + cellZ * cellWidth); + + return x == pointX && z == pointZ; + } +} diff --git a/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java b/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java index bbbd4fa3e..844b9681c 100644 --- a/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java +++ b/common/addons/config-flora/src/main/java/com/dfsek/terra/addons/flora/flora/gen/TerraFlora.java @@ -74,7 +74,7 @@ public class TerraFlora implements Structure { } @Override - public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation) { boolean doRotation = testRotation.size() > 0; int size = layers.size(); int c = ceiling ? -1 : 1; @@ -86,7 +86,7 @@ public class TerraFlora implements Structure { for(int i = 0; FastMath.abs(i) < size; i += c) { // Down if ceiling, up if floor int lvl = (FastMath.abs(i)); BlockState data = getStateCollection((ceiling ? lvl : size - lvl - 1)).get(distribution, location.getX(), location.getY(), - location.getZ(), seed); + location.getZ(), world.getSeed()); world.setBlockState(location.mutable().add(0, i + c, 0).immutable(), data, physics); } diff --git a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/LocatorAddon.java b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/LocatorAddon.java index 9cb6282e7..70018a038 100644 --- a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/LocatorAddon.java +++ b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/LocatorAddon.java @@ -13,10 +13,8 @@ import java.util.function.Supplier; import com.dfsek.terra.addons.feature.locator.config.AdjacentPatternLocatorTemplate; import com.dfsek.terra.addons.feature.locator.config.AndLocatorTemplate; -import com.dfsek.terra.addons.feature.locator.config.GaussianRandomLocatorTemplate; import com.dfsek.terra.addons.feature.locator.config.OrLocatorTemplate; import com.dfsek.terra.addons.feature.locator.config.PatternLocatorTemplate; -import com.dfsek.terra.addons.feature.locator.config.RandomLocatorTemplate; import com.dfsek.terra.addons.feature.locator.config.Sampler3DLocatorTemplate; import com.dfsek.terra.addons.feature.locator.config.SamplerLocatorTemplate; import com.dfsek.terra.addons.feature.locator.config.SurfaceLocatorTemplate; @@ -35,11 +33,8 @@ 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.api.Platform; -import com.dfsek.terra.api.addon.BaseAddon; import com.dfsek.terra.api.event.events.config.pack.ConfigPackPreLoadEvent; import com.dfsek.terra.api.event.functional.FunctionalEventHandler; -import com.dfsek.terra.api.inject.annotations.Inject; import com.dfsek.terra.api.registry.CheckedRegistry; import com.dfsek.terra.api.structure.feature.Locator; import com.dfsek.terra.api.util.function.monad.Monad; @@ -66,9 +61,6 @@ public class LocatorAddon implements MonadAddonInitializer { locatorRegistry.register(base.key("SURFACE"), SurfaceLocatorTemplate::new); locatorRegistry.register(base.key("TOP"), TopLocatorTemplate::new); - locatorRegistry.register(base.key("RANDOM"), RandomLocatorTemplate::new); - locatorRegistry.register(base.key("GAUSSIAN_RANDOM"), GaussianRandomLocatorTemplate::new); - locatorRegistry.register(base.key("PATTERN"), PatternLocatorTemplate::new); locatorRegistry.register(base.key("ADJACENT_PATTERN"), AdjacentPatternLocatorTemplate::new); diff --git a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/config/GaussianRandomLocatorTemplate.java b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/config/GaussianRandomLocatorTemplate.java deleted file mode 100644 index 80af89793..000000000 --- a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/config/GaussianRandomLocatorTemplate.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.feature.locator.config; - -import com.dfsek.tectonic.api.config.template.annotations.Default; -import com.dfsek.tectonic.api.config.template.annotations.Value; -import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; - -import com.dfsek.terra.addons.feature.locator.locators.GaussianRandomLocator; -import com.dfsek.terra.api.config.meta.Meta; -import com.dfsek.terra.api.structure.feature.Locator; -import com.dfsek.terra.api.util.Range; - - -@SuppressWarnings("FieldMayBeFinal") -public class GaussianRandomLocatorTemplate implements ObjectTemplate { - @Value("height") - private @Meta Range height; - - @Value("amount") - private @Meta Range amount; - - @Value("standard-deviation") - private @Meta double standardDeviation; - - @Value("salt") - @Default - private @Meta int salt = 0; - - @Override - public Locator get() { - return new GaussianRandomLocator(height, amount, standardDeviation, salt); - } -} diff --git a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/config/RandomLocatorTemplate.java b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/config/RandomLocatorTemplate.java deleted file mode 100644 index 9bdb3f6db..000000000 --- a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/config/RandomLocatorTemplate.java +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.feature.locator.config; - -import com.dfsek.tectonic.api.config.template.annotations.Default; -import com.dfsek.tectonic.api.config.template.annotations.Value; -import com.dfsek.tectonic.api.config.template.object.ObjectTemplate; - -import com.dfsek.terra.addons.feature.locator.locators.RandomLocator; -import com.dfsek.terra.api.config.meta.Meta; -import com.dfsek.terra.api.structure.feature.Locator; -import com.dfsek.terra.api.util.Range; - - -@SuppressWarnings("FieldMayBeFinal") -public class RandomLocatorTemplate implements ObjectTemplate { - @Value("height") - private @Meta Range height; - - @Value("amount") - private @Meta Range amount; - - @Value("salt") - @Default - private @Meta int salt = 0; - - @Override - public Locator get() { - return new RandomLocator(height, amount, salt); - } -} diff --git a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/GaussianRandomLocator.java b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/GaussianRandomLocator.java deleted file mode 100644 index 471ef0cd5..000000000 --- a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/GaussianRandomLocator.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.feature.locator.locators; - -import java.util.random.RandomGenerator; -import java.util.random.RandomGeneratorFactory; - -import com.dfsek.terra.api.structure.feature.BinaryColumn; -import com.dfsek.terra.api.structure.feature.Locator; -import com.dfsek.terra.api.util.Range; -import com.dfsek.terra.api.world.chunk.generation.util.Column; -import com.dfsek.terra.api.world.chunk.generation.util.Column.BinaryColumnBuilder; - - -public class GaussianRandomLocator implements Locator { - private final double mean; - - private final Range points; - - private final double standardDeviation; - - private final int salt; - - - public GaussianRandomLocator(Range height, Range points, double standardDeviation, int salt) { - this.mean = (height.getMax() + height.getMin()) / 2.0; - this.points = points; - this.standardDeviation = standardDeviation; - this.salt = salt; - } - - @Override - public BinaryColumn getSuitableCoordinates(Column column) { - long seed = column.getWorld().getSeed(); - seed = 31 * seed + column.getX(); - seed = 31 * seed + column.getZ(); - seed += salt; - - RandomGenerator r = RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create(seed); - - int size = points.get(r); - - - BinaryColumnBuilder results = column.newBinaryColumn(); - for(int i = 0; i < size; i++) { - int h = (int) r.nextGaussian(mean, standardDeviation); - if(h >= column.getMaxY() || h < column.getMinY()) continue; - results.set(h); - } - - return results.build(); - } -} diff --git a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/RandomLocator.java b/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/RandomLocator.java deleted file mode 100644 index fb91e469a..000000000 --- a/common/addons/config-locators/src/main/java/com/dfsek/terra/addons/feature/locator/locators/RandomLocator.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra Core Addons are licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in this module's root directory. - */ - -package com.dfsek.terra.addons.feature.locator.locators; - -import java.util.random.RandomGenerator; -import java.util.random.RandomGeneratorFactory; - -import com.dfsek.terra.api.structure.feature.BinaryColumn; -import com.dfsek.terra.api.structure.feature.Locator; -import com.dfsek.terra.api.util.Range; -import com.dfsek.terra.api.world.chunk.generation.util.Column; -import com.dfsek.terra.api.world.chunk.generation.util.Column.BinaryColumnBuilder; - - -public class RandomLocator implements Locator { - private final Range height; - - private final Range points; - - private final int salt; - - public RandomLocator(Range height, Range points, int salt) { - this.height = height; - this.points = points; - this.salt = salt; - } - - @Override - public BinaryColumn getSuitableCoordinates(Column column) { - long seed = column.getWorld().getSeed(); - seed = 31 * seed + column.getX(); - seed = 31 * seed + column.getZ(); - seed += salt; - - RandomGenerator r = RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create(seed); - - int size = points.get(r); - - BinaryColumnBuilder results = column.newBinaryColumn(); - for(int i = 0; i < size; i++) { - int h = height.get(r); - if(h >= column.getMaxY() || h < column.getMinY()) continue; - results.set(h); - } - - return results.build(); - } -} diff --git a/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java b/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java index 02e98dd56..2b3c333d7 100644 --- a/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java +++ b/common/addons/config-ore/src/main/java/com/dfsek/terra/addons/ore/ores/VanillaOre.java @@ -47,26 +47,26 @@ public class VanillaOre implements Structure { } @Override - public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed){ + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation){ int centerX = location.getX(); int centerZ = location.getZ(); int centerY = location.getY(); - double f = sampler.noise(centerX, centerY, centerZ, seed) * (float) Math.PI; + double f = sampler.noise(centerX, centerY, centerZ, world.getSeed()) * (float) Math.PI; double d1 = centerX + 8 + FastMath.sin(f) * size / 8.0F; double d2 = centerX + 8 - FastMath.sin(f) * size / 8.0F; double d3 = centerZ + 8 + FastMath.cos(f) * size / 8.0F; double d4 = centerZ + 8 - FastMath.cos(f) * size / 8.0F; - double d5 = centerY + (Math.round(sampler.noise(centerX, centerY, centerZ, seed + 1) + 1)) - 2D; - double d6 = centerY + (Math.round(sampler.noise(centerX, centerY, centerZ, seed + 2) + 1)) - 2D; + double d5 = centerY + (Math.round(sampler.noise(centerX, centerY, centerZ, world.getSeed() + 1) + 1)) - 2D; + double d6 = centerY + (Math.round(sampler.noise(centerX, centerY, centerZ, world.getSeed() + 2) + 1)) - 2D; for(int i = 0; i < size; i++) { float iFactor = (float) i / (float) size; - double d10 = MathUtil.inverseLerp(sampler.noise(centerX, centerY, centerZ, seed + 2 + (i * 2 - 1)), -1, 1) * size / 16.0D; + double d10 = MathUtil.inverseLerp(sampler.noise(centerX, centerY, centerZ, world.getSeed() + 2 + (i * 2 - 1)), -1, 1) * size / 16.0D; double d11 = (FastMath.sin(Math.PI * iFactor) + 1.0) * d10 + 1.0; double d12 = (FastMath.sin(Math.PI * iFactor) + 1.0) * d10 + 1.0; @@ -90,7 +90,7 @@ public class VanillaOre implements Structure { if(y >= world.getMaxHeight() || y < world.getMinHeight()) continue; BlockType block = world.getBlockState(x, y, z).getBlockType(); if((d13 * d13 + d14 * d14 + d15 * d15 < 1.0D) && getReplaceable().contains(block)) { - if(exposed > MathUtil.inverseLerp(sampler.noise(centerX, centerY, centerZ, seed + 2 + (i * 2)), -1, 1) || !(world.getBlockState(x, y, z - 1).isAir() || + if(exposed > MathUtil.inverseLerp(sampler.noise(centerX, centerY, centerZ, world.getSeed() + 2 + (i * 2)), -1, 1) || !(world.getBlockState(x, y, z - 1).isAir() || world.getBlockState(x, y, z + 1).isAir() || world.getBlockState(x, y - 1, z).isAir() || world.getBlockState(x, y + 1, z).isAir() || diff --git a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java index 6b300d778..527c15159 100644 --- a/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java +++ b/common/addons/generation-stage-feature/src/main/java/com/dfsek/terra/addons/generation/feature/FeatureGenerationStage.java @@ -59,7 +59,6 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab for(int subChunkZ = 0; subChunkZ < resolution; subChunkZ++) { int x = subChunkX + tx; int z = subChunkZ + tz; - long coordinateSeed = (seed * 31 + x) * 31 + z; Column column = world.column(x, z); biome.getContext() .get(biomeFeaturesKey) @@ -73,8 +72,7 @@ public class FeatureGenerationStage implements GenerationStage, StringIdentifiab .forEach(y -> feature.getStructure(world, x, y, z) .generate(Vector3Int.of(x, y, z), world, - Rotation.NONE, - coordinateSeed * 31 + y) + Rotation.NONE) ); } platform.getProfiler().pop(feature.getID()); diff --git a/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java b/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java index 831857c1f..83b37c652 100644 --- a/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java +++ b/common/addons/structure-block-shortcut/src/main/java/com/dfsek/terra/addons/palette/shortcut/block/SingletonStructure.java @@ -17,7 +17,7 @@ public class SingletonStructure implements Structure { } @Override - public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation) { world.setBlockState(location, blockState); return true; } diff --git a/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java b/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java index 9b5bbb90c..c05d5a320 100644 --- a/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java +++ b/common/addons/structure-mutator/src/main/java/com/dfsek/terra/addons/structure/mutator/MutatedStructure.java @@ -32,12 +32,12 @@ public class MutatedStructure implements Structure, Keyed { } @Override - public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation) { return base.generate(location, world .buffer() .read(readInterceptor) .write(writeInterceptor) - .build(), rotation, seed); + .build(), rotation); } } diff --git a/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java b/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java index ef290b66c..cf8df81e5 100644 --- a/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java +++ b/common/addons/structure-sponge-loader/src/main/java/com/dfsek/terra/addons/sponge/SpongeStructure.java @@ -31,7 +31,7 @@ public class SpongeStructure implements Structure, Keyed { } @Override - public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation) { int bX = location.getX(); int bY = location.getY(); int bZ = location.getZ(); diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java index d58975640..de0b7a39f 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/StructureScript.java @@ -128,7 +128,7 @@ public class StructureScript implements Structure, Keyed { @Override @SuppressWarnings("try") - public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long seed) { + public boolean generate(Vector3Int location, WritableWorld world, Rotation rotation) { platform.getProfiler().push(profile); boolean result = applyBlock(new TerraImplementationArguments(location, rotation, world, 0)); platform.getProfiler().pop(profile); diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/LootFunction.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/LootFunction.java index a58ee67d5..f785e17d3 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/LootFunction.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/LootFunction.java @@ -85,9 +85,7 @@ public class LootFunction implements Function { platform.getEventManager().callEvent(event); if(event.isCancelled()) return; - event.getTable().fillInventory(container.getInventory(), - RandomGeneratorFactory.of( - "Xoroshiro128PlusPlus").create(apply.hashCode())); + event.getTable().fillInventory(container.getInventory()); data.update(false); } catch(Exception e) { LOGGER.error("Could not apply loot at {}", apply, e); diff --git a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/StructureFunction.java b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/StructureFunction.java index 57c7dd943..84245a763 100644 --- a/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/StructureFunction.java +++ b/common/addons/structure-terrascript-loader/src/main/java/com/dfsek/terra/addons/terrascript/script/functions/StructureFunction.java @@ -80,7 +80,7 @@ public class StructureFunction implements Function { .buffer(FastMath.roundToInt(xz.getX()), y.apply(implementationArguments, scope).intValue(), FastMath.roundToInt(xz.getZ())), - arguments.getRotation(), arguments.getWorld().getSeed()); + arguments.getRotation()); }).orElseGet(() -> { LOGGER.error("No such structure {}", app); return false; diff --git a/common/api/src/main/java/com/dfsek/terra/api/structure/LootTable.java b/common/api/src/main/java/com/dfsek/terra/api/structure/LootTable.java index 64f1f250e..8995413e9 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/structure/LootTable.java +++ b/common/api/src/main/java/com/dfsek/terra/api/structure/LootTable.java @@ -22,9 +22,8 @@ public interface LootTable { * Fills an Inventory with loot. * * @param i The Inventory to fill. - * @param r The The RandomGenerator instance to use. */ - void fillInventory(Inventory i, RandomGenerator r); + void fillInventory(Inventory i); /** * Fetches a list of ItemStacks from the loot table using the given RandomGenerator instance. diff --git a/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java b/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java index 48fb5a069..ddd2d77ed 100644 --- a/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java +++ b/common/api/src/main/java/com/dfsek/terra/api/structure/Structure.java @@ -16,5 +16,5 @@ import com.dfsek.terra.api.world.WritableWorld; public interface Structure { - boolean generate(Vector3Int location, WritableWorld world, Rotation rotation, Long Seed); + boolean generate(Vector3Int location, WritableWorld world, Rotation rotation); } diff --git a/common/api/src/main/java/com/dfsek/terra/api/util/PopulationUtil.java b/common/api/src/main/java/com/dfsek/terra/api/util/PopulationUtil.java deleted file mode 100644 index 6360bc028..000000000 --- a/common/api/src/main/java/com/dfsek/terra/api/util/PopulationUtil.java +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (c) 2020-2021 Polyhedral Development - * - * The Terra API is licensed under the terms of the MIT License. For more details, - * reference the LICENSE file in the common/api directory. - */ - -package com.dfsek.terra.api.util; - -import java.util.random.RandomGenerator; -import java.util.random.RandomGeneratorFactory; - -import com.dfsek.terra.api.world.chunk.Chunk; - - -public final class PopulationUtil { - public static RandomGenerator getRandom(Chunk c) { - return getRandom(c, 0); - } - - public static RandomGenerator getRandom(Chunk c, long salt) { - return RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create( - getCarverChunkSeed(c.getX(), c.getZ(), c.getWorld().getSeed() + salt)); - } - - /** - * Gets the carver seed for a chunk. - * - * @param chunkX Chunk's X coordinate - * @param chunkZ Chunk's Z coordinate - * @param seed World seed - * - * @return long - The carver seed. - */ - public static long getCarverChunkSeed(int chunkX, int chunkZ, long seed) { - RandomGenerator r = RandomGeneratorFactory.of("Xoroshiro128PlusPlus").create(seed); - return chunkX * r.nextLong() ^ chunkZ * r.nextLong() ^ seed; - } -} diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java index df17f905a..52d95d33d 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/mixin/gameplay/BoneMealTaskMixin.java @@ -3,6 +3,8 @@ package com.dfsek.terra.mod.mixin.gameplay; import com.dfsek.terra.api.world.World; +import com.dfsek.terra.mod.util.WritableWorldSeedRedirecter; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.ai.brain.task.BoneMealTask; @@ -45,7 +47,7 @@ public class BoneMealTaskMixin { if(canGrow != null) { RandomGenerator random = MinecraftAdapter.adapt(world.getRandom()); cir.setReturnValue(canGrow.generate( - Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, Rotation.NONE, world.getSeed() + random.nextLong(Long.MAX_VALUE))); + Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), new WritableWorldSeedRedirecter((WritableWorld) world, world.getSeed() + random.nextLong(Long.MAX_VALUE)), Rotation.NONE)); return; } cir.setReturnValue(true); diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java index fcb4e87bd..588df823b 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/FertilizableUtil.java @@ -27,7 +27,7 @@ public class FertilizableUtil { Structure canGrow = config.getCanGrow(); if(canGrow != null) { if(!canGrow.generate( - Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, Rotation.NONE, world.getSeed() + random.nextLong(Long.MAX_VALUE))) { + Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), new WritableWorldSeedRedirecter((WritableWorld) world, world.getSeed() + random.nextLong(Long.MAX_VALUE)), Rotation.NONE)) { return false; } } @@ -38,7 +38,7 @@ public class FertilizableUtil { } } config.getStructures().get(random).generate( - Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), (WritableWorld) world, Rotation.NONE, world.getSeed() + random.nextLong(Long.MAX_VALUE)); + Vector3Int.of(pos.getX(), pos.getY(), pos.getZ()), new WritableWorldSeedRedirecter((WritableWorld) world, world.getSeed() + random.nextLong(Long.MAX_VALUE)), Rotation.NONE); return true; } } diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/WritableWorldSeedRedirecter.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/WritableWorldSeedRedirecter.java new file mode 100644 index 000000000..ba453eff6 --- /dev/null +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/WritableWorldSeedRedirecter.java @@ -0,0 +1,168 @@ +package com.dfsek.terra.mod.util; + +import com.dfsek.terra.api.block.entity.BlockEntity; +import com.dfsek.terra.api.block.state.BlockState; +import com.dfsek.terra.api.config.ConfigPack; +import com.dfsek.terra.api.entity.Entity; +import com.dfsek.terra.api.entity.EntityType; +import com.dfsek.terra.api.util.vector.Vector3; +import com.dfsek.terra.api.util.vector.Vector3.Mutable; +import com.dfsek.terra.api.util.vector.Vector3Int; +import com.dfsek.terra.api.world.BufferedWorld; +import com.dfsek.terra.api.world.BufferedWorld.Builder; +import com.dfsek.terra.api.world.WritableWorld; +import com.dfsek.terra.api.world.biome.generation.BiomeProvider; +import com.dfsek.terra.api.world.chunk.generation.ChunkGenerator; +import com.dfsek.terra.api.world.chunk.generation.util.Column; + + +public class WritableWorldSeedRedirecter implements WritableWorld { + private final WritableWorld delegate; + private final long seed; + + + public WritableWorldSeedRedirecter(WritableWorld delegate, long seed) { + this.delegate = delegate; + this.seed = seed; + } + + @Override + public Object getHandle() { + return delegate.getHandle(); + } + + @Override + public BlockState getBlockState(int x, int y, int z) { + return delegate.getBlockState(x, y, z); + } + + @Override + public BlockState getBlockState(Vector3 position) { + return delegate.getBlockState(position); + } + + @Override + public BlockState getBlockState(Vector3Int position) { + return delegate.getBlockState(position); + } + + @Override + public BlockEntity getBlockEntity(int x, int y, int z) { + return delegate.getBlockEntity(x, y, z); + } + + @Override + public BlockEntity getBlockEntity(Vector3 position) { + return delegate.getBlockEntity(position); + } + + @Override + public BlockEntity getBlockEntity(Vector3Int position) { + return delegate.getBlockEntity(position); + } + + @Override + public ChunkGenerator getGenerator() { + return delegate.getGenerator(); + } + + @Override + public BiomeProvider getBiomeProvider() { + return delegate.getBiomeProvider(); + } + + @Override + public ConfigPack getPack() { + return delegate.getPack(); + } + + @Override + public void setBlockState(Vector3 position, BlockState data, boolean physics) { + delegate.setBlockState(position, data, physics); + } + + @Override + public void setBlockState(Mutable position, BlockState data, boolean physics) { + delegate.setBlockState(position, data, physics); + } + + @Override + public void setBlockState(Vector3Int position, BlockState data, boolean physics) { + delegate.setBlockState(position, data, physics); + } + + @Override + public void setBlockState(Vector3Int.Mutable position, BlockState data, boolean physics) { + delegate.setBlockState(position, data, physics); + } + + @Override + public void setBlockState(Vector3 position, BlockState data) { + delegate.setBlockState(position, data); + } + + @Override + public void setBlockState(Mutable position, BlockState data) { + delegate.setBlockState(position, data); + } + + @Override + public void setBlockState(Vector3Int position, BlockState data) { + delegate.setBlockState(position, data); + } + + @Override + public void setBlockState(Vector3Int.Mutable position, BlockState data) { + delegate.setBlockState(position, data); + } + + @Override + public void setBlockState(int x, int y, int z, BlockState data) { + delegate.setBlockState(x, y, z, data); + } + + @Override + public void setBlockState(int x, int y, int z, BlockState data, boolean physics) { + delegate.setBlockState(x, y, z, data, physics); + } + + @Override + public Entity spawnEntity(Vector3 location, EntityType entityType) { + return delegate.spawnEntity(location, entityType); + } + + @Override + public Entity spawnEntity(double x, double y, double z, EntityType entityType) { + return delegate.spawnEntity(x, y, z, entityType); + } + + @Override + public BufferedWorld buffer(int offsetX, int offsetY, int offsetZ) { + return delegate.buffer(offsetX, offsetY, offsetZ); + } + + @Override + public Builder buffer() { + return delegate.buffer(); + } + + @Override + public Column column(int x, int z) { + return delegate.column(x, z); + } + + @Override + public long getSeed() { + return seed; + } + + @Override + public int getMaxHeight() { + return delegate.getMaxHeight(); + } + + @Override + public int getMinHeight() { + return delegate.getMinHeight(); + } +} From 0b8524b08db54f304238c395e7cfa0c0e354ed52 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zo=C3=AB?= Date: Sun, 21 Aug 2022 14:33:57 -0500 Subject: [PATCH 11/11] remove comment --- .../src/main/java/com/dfsek/terra/mod/util/PresetUtil.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java index 7618678ce..fe44e4f80 100644 --- a/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java +++ b/platforms/mixin-common/src/main/java/com/dfsek/terra/mod/util/PresetUtil.java @@ -46,12 +46,6 @@ public class PresetUtil { public static RegistryKey getPresetKey(Identifier identifier) { return RegistryKey.of(Registry.WORLD_PRESET_KEY, identifier); } - -// public static void addPreset() { -// LevelScreenProvider -// LevelScreenProvider.WORLD_PRESET_TO_SCREEN_PROVIDER.put(Optional.ofNullable(getPresetKey(new Identifier("terra", "terra"))), new TerraPresetScreen()); -// } - public static Pair createDefault(ConfigPack pack) { Registry dimensionTypeRegistry = BuiltinRegistries.DIMENSION_TYPE; Registry chunkGeneratorSettingsRegistry = BuiltinRegistries.CHUNK_GENERATOR_SETTINGS;