Some changes for 1.18.2
This commit is contained in:
parent
65e9140812
commit
753d0dd658
78 changed files with 232 additions and 237 deletions
|
@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx2G
|
|||
loom_version=0.12-SNAPSHOT
|
||||
# Fabric Properties
|
||||
# check these on https://fabricmc.net/versions.html
|
||||
minecraft_version=1.19
|
||||
minecraft_version=1.18.2
|
||||
loader_version=0.14.8
|
||||
fabric_version=0.57.0+1.19
|
||||
# Mod Properties
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.betterx.bclib.util.WeightedList;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
|
@ -13,6 +12,7 @@ import com.google.common.collect.Maps;
|
|||
import com.google.common.collect.Sets;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
|
@ -162,7 +162,7 @@ public class BonemealAPI {
|
|||
public static BiConsumer<Level, BlockPos> getLandGrass(
|
||||
ResourceLocation biomeID,
|
||||
Block terrain,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
Map<Block, WeightedList<BiConsumer<Level, BlockPos>>> map = LAND_GRASS_BIOMES.get(biomeID);
|
||||
WeightedList<BiConsumer<Level, BlockPos>> list;
|
||||
|
@ -180,7 +180,7 @@ public class BonemealAPI {
|
|||
public static BiConsumer<Level, BlockPos> getWaterGrass(
|
||||
ResourceLocation biomeID,
|
||||
Block terrain,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
Map<Block, WeightedList<BiConsumer<Level, BlockPos>>> map = WATER_GRASS_BIOMES.get(biomeID);
|
||||
WeightedList<BiConsumer<Level, BlockPos>> list;
|
||||
|
|
|
@ -217,7 +217,7 @@ public class BCLChunkGenerator extends NoiseBasedChunkGenerator implements Resto
|
|||
// old.disableMobGeneration(),
|
||||
// old.aquifersEnabled(),
|
||||
// old.oreVeinsEnabled(),
|
||||
// old.useLegacyRandomSource()
|
||||
// old.useLegacyRandom()
|
||||
// );
|
||||
//
|
||||
//
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.betterx.bclib.interfaces.TriConsumer;
|
|||
import org.betterx.bclib.noise.OpenSimplexNoise;
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
|
||||
|
@ -81,7 +80,7 @@ public class HexBiomeMap implements BiomeMap {
|
|||
final ChunkPos pos = new ChunkPos(cx, cz);
|
||||
HexBiomeChunk chunk = chunks.get(pos);
|
||||
if (chunk == null) {
|
||||
WorldgenRandom random = new WorldgenRandom(RandomSource.create(MHelper.getSeed(seed, cx, cz)));
|
||||
WorldgenRandom random = new WorldgenRandom(Random.create(MHelper.getSeed(seed, cx, cz)));
|
||||
chunk = new HexBiomeChunk(random, picker);
|
||||
if (update && processor != null) {
|
||||
processor.accept(cx, cz, chunk.getSide());
|
||||
|
|
|
@ -8,7 +8,7 @@ import org.betterx.bclib.noise.OpenSimplexNoise;
|
|||
import org.betterx.bclib.util.MHelper;
|
||||
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.levelgen.LegacyRandomSource;
|
||||
import net.minecraft.world.level.levelgen.LegacyRandom;
|
||||
import net.minecraft.world.level.levelgen.WorldgenRandom;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
@ -29,7 +29,7 @@ public class SquareBiomeMap implements BiomeMap {
|
|||
private TriConsumer<Integer, Integer, Integer> processor;
|
||||
|
||||
public SquareBiomeMap(long seed, int size, BiomePicker picker) {
|
||||
random = new WorldgenRandom(new LegacyRandomSource(seed));
|
||||
random = new WorldgenRandom(new LegacyRandom(seed));
|
||||
noiseX = new OpenSimplexNoise(random.nextLong());
|
||||
noiseZ = new OpenSimplexNoise(random.nextLong());
|
||||
this.sizeXZ = size;
|
||||
|
|
|
@ -23,8 +23,6 @@ import net.minecraft.world.level.chunk.ChunkGenerator;
|
|||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPresets;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
|
|
@ -32,7 +32,6 @@ import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
|||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import net.minecraft.world.level.chunk.PalettedContainerRO;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
|
@ -152,7 +151,7 @@ public class BiomeAPI {
|
|||
TagManager.BIOMES.add(BiomeTags.IS_NETHER, bclbiome.getBiome());
|
||||
TagManager.BIOMES.add(CommonBiomeTags.IN_NETHER, bclbiome.getBiome());
|
||||
} else if (dim != null && dim.is(BiomeType.END)) {
|
||||
TagManager.BIOMES.add(BiomeTags.IS_END, bclbiome.getBiome());
|
||||
TagManager.BIOMES.add(CommonBiomeTags.IN_END, bclbiome.getBiome());
|
||||
}
|
||||
|
||||
bclbiome.afterRegistration();
|
||||
|
@ -440,10 +439,10 @@ public class BiomeAPI {
|
|||
public static Holder<Biome> getBiomeHolder(Biome biome) {
|
||||
if (InternalBiomeAPI.biomeRegistry != null) {
|
||||
Optional<ResourceKey<Biome>> key = InternalBiomeAPI.biomeRegistry.getResourceKey(biome);
|
||||
if (key.isPresent()) return InternalBiomeAPI.biomeRegistry.getOrCreateHolderOrThrow(key.get());
|
||||
if (key.isPresent()) return InternalBiomeAPI.biomeRegistry.getOrCreateHolder(key.get());
|
||||
}
|
||||
|
||||
return BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(BiomeAPI.getBiomeKey(biome));
|
||||
return BuiltinRegistries.BIOME.getOrCreateHolder(BiomeAPI.getBiomeKey(biome));
|
||||
}
|
||||
|
||||
public static Holder<Biome> getBiomeHolder(ResourceLocation biome) {
|
||||
|
@ -500,7 +499,7 @@ public class BiomeAPI {
|
|||
|
||||
@Nullable
|
||||
public static Holder<Biome> getFromRegistry(ResourceKey<Biome> key) {
|
||||
return BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(key);
|
||||
return BuiltinRegistries.BIOME.getOrCreateHolder(key);
|
||||
}
|
||||
|
||||
public static boolean isDatapackBiome(ResourceLocation biomeID) {
|
||||
|
@ -786,12 +785,8 @@ public class BiomeAPI {
|
|||
*/
|
||||
public static void setBiome(ChunkAccess chunk, BlockPos pos, Holder<Biome> biome) {
|
||||
int sectionY = (pos.getY() - chunk.getMinBuildHeight()) >> 4;
|
||||
PalettedContainerRO<Holder<Biome>> biomes = chunk.getSection(sectionY).getBiomes();
|
||||
if (biomes instanceof PalettedContainer<Holder<Biome>> palette) {
|
||||
PalettedContainer<Holder<Biome>> palette = chunk.getSection(sectionY).getBiomes();
|
||||
palette.set((pos.getX() & 15) >> 2, (pos.getY() & 15) >> 2, (pos.getZ() & 15) >> 2, biome);
|
||||
} else {
|
||||
BCLib.LOGGER.warning("Unable to change Biome at " + pos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -21,7 +21,6 @@ import net.minecraft.data.worldgen.placement.PlacementUtils;
|
|||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
|
@ -35,6 +34,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
|||
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @param <F>
|
||||
|
@ -237,7 +237,7 @@ public class BCLFeature<F extends Feature<FC>, FC extends FeatureConfiguration>
|
|||
return proxy.getConfiguration();
|
||||
}
|
||||
|
||||
public boolean place(ServerLevel level, BlockPos pos, RandomSource random) {
|
||||
public boolean place(ServerLevel level, BlockPos pos, Random random) {
|
||||
return place(this.getFeature(), this.getConfiguration(), level, pos, random);
|
||||
}
|
||||
|
||||
|
@ -246,7 +246,7 @@ public class BCLFeature<F extends Feature<FC>, FC extends FeatureConfiguration>
|
|||
FeatureConfiguration config,
|
||||
ServerLevel level,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
if (config instanceof RandomPatchConfiguration rnd) {
|
||||
var configured = rnd.feature().value().feature().value();
|
||||
|
@ -273,7 +273,7 @@ public class BCLFeature<F extends Feature<FC>, FC extends FeatureConfiguration>
|
|||
Feature<NoneFeatureConfiguration> feature,
|
||||
ServerLevel level,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
return placeUnbound(feature, FeatureConfiguration.NONE, level, pos, random);
|
||||
}
|
||||
|
@ -283,7 +283,7 @@ public class BCLFeature<F extends Feature<FC>, FC extends FeatureConfiguration>
|
|||
FC config,
|
||||
ServerLevel level,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
return placeUnbound(feature, config, level, pos, random);
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.mojang.datafixers.util.Function15;
|
|||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.valueproviders.ConstantInt;
|
||||
import net.minecraft.util.valueproviders.IntProvider;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
|
@ -18,6 +17,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfigur
|
|||
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class ScatterFeatureConfig implements FeatureConfiguration {
|
||||
public interface Instancer<T extends ScatterFeatureConfig> extends Function15<BlockStateProvider, Optional<BlockStateProvider>, Optional<BlockStateProvider>, Optional<BlockState>, Float, Float, Float, Float, Integer, Integer, Float, Float, Float, Boolean, IntProvider, T> {
|
||||
|
@ -76,13 +76,13 @@ public abstract class ScatterFeatureConfig implements FeatureConfiguration {
|
|||
}
|
||||
|
||||
|
||||
public boolean isFloor(RandomSource random) {
|
||||
public boolean isFloor(Random random) {
|
||||
return random.nextFloat() < floorChance;
|
||||
}
|
||||
|
||||
public abstract boolean isValidBase(BlockState state);
|
||||
|
||||
public abstract BlockState createBlock(int height, int maxHeight, RandomSource random, BlockPos pos);
|
||||
public abstract BlockState createBlock(int height, int maxHeight, Random random, BlockPos pos);
|
||||
|
||||
public static <T extends ScatterFeatureConfig> Codec<T> buildCodec(Instancer<T> instancer) {
|
||||
return RecordCodecBuilder.create((instance) -> instance
|
||||
|
@ -420,7 +420,7 @@ public abstract class ScatterFeatureConfig implements FeatureConfiguration {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlock(int height, int maxHeight, RandomSource random, BlockPos pos) {
|
||||
public BlockState createBlock(int height, int maxHeight, Random random, BlockPos pos) {
|
||||
if (height == 0) return this.bottomBlock.getState(random, pos);
|
||||
return height == maxHeight
|
||||
? this.tipBlock.getState(random, pos)
|
||||
|
@ -480,7 +480,7 @@ public abstract class ScatterFeatureConfig implements FeatureConfiguration {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlock(int height, int maxHeight, RandomSource random, BlockPos pos) {
|
||||
public BlockState createBlock(int height, int maxHeight, Random random, BlockPos pos) {
|
||||
if (height == 0) return this.bottomBlock.getState(random, pos);
|
||||
if (height == 1) return this.clusterBlock.getState(random, pos);
|
||||
return this.tipBlock.getState(random, pos);
|
||||
|
@ -538,7 +538,7 @@ public abstract class ScatterFeatureConfig implements FeatureConfiguration {
|
|||
}
|
||||
|
||||
@Override
|
||||
public BlockState createBlock(int height, int maxHeight, RandomSource random, BlockPos pos) {
|
||||
public BlockState createBlock(int height, int maxHeight, Random random, BlockPos pos) {
|
||||
if (height == maxHeight) return this.tipBlock.getState(random, pos);
|
||||
if (height == maxHeight - 1) return this.clusterBlock.getState(random, pos);
|
||||
return this.bottomBlock.getState(random, pos);
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.betterx.bclib.util.BlocksHelper;
|
|||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -16,6 +15,7 @@ import net.minecraft.world.level.levelgen.feature.Feature;
|
|||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public class ScatterFeature<FC extends ScatterFeatureConfig>
|
||||
|
@ -29,7 +29,7 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
|
|||
public boolean place(FeaturePlaceContext<FC> featurePlaceContext) {
|
||||
final WorldGenLevel level = featurePlaceContext.level();
|
||||
final BlockPos origin = featurePlaceContext.origin();
|
||||
final RandomSource random = featurePlaceContext.random();
|
||||
final Random random = featurePlaceContext.random();
|
||||
|
||||
ScatterFeatureConfig config = featurePlaceContext.config();
|
||||
Optional<Direction> direction = getTipDirection(level, origin, random, config);
|
||||
|
@ -52,7 +52,7 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
|
|||
Direction direction,
|
||||
int centerHeight,
|
||||
ScatterFeatureConfig config,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
if (config.isValidBase(level.getBlockState(basePos))) {
|
||||
final Direction surfaceDirection = direction.getOpposite();
|
||||
|
@ -131,7 +131,7 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
|
|||
Direction direction,
|
||||
int height,
|
||||
ScatterFeatureConfig config,
|
||||
RandomSource random,
|
||||
Random random,
|
||||
boolean force
|
||||
) {
|
||||
if (force || BlocksHelper.isFreeSpace(level, origin, direction, height, BlocksHelper::isFree)) {
|
||||
|
@ -149,7 +149,7 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
|
|||
Direction direction,
|
||||
int height,
|
||||
ScatterFeatureConfig config,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
|
||||
final BlockPos.MutableBlockPos POS = origin.mutable();
|
||||
|
@ -163,14 +163,14 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
|
|||
private Optional<Direction> getTipDirection(
|
||||
LevelAccessor levelAccessor,
|
||||
BlockPos blockPos,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
ScatterFeatureConfig config
|
||||
) {
|
||||
boolean onCeil = config.floorChance < 1 && config.isValidBase(levelAccessor.getBlockState(blockPos.above()));
|
||||
boolean onFloor = config.floorChance > 0 && config.isValidBase(levelAccessor.getBlockState(blockPos.below()));
|
||||
|
||||
if (onCeil && onFloor) {
|
||||
return Optional.of(config.isFloor(randomSource) ? Direction.DOWN : Direction.UP);
|
||||
return Optional.of(config.isFloor(Random) ? Direction.DOWN : Direction.UP);
|
||||
}
|
||||
if (onCeil) {
|
||||
return Optional.of(Direction.DOWN);
|
||||
|
@ -183,24 +183,24 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
|
|||
|
||||
private void createPatchOfBaseBlocks(
|
||||
LevelAccessor levelAccessor,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
BlockPos blockPos,
|
||||
ScatterFeatureConfig config
|
||||
) {
|
||||
if (config.baseState.isPresent() && config.baseReplaceChance > 0 && randomSource.nextFloat() < config.baseReplaceChance) {
|
||||
if (config.baseState.isPresent() && config.baseReplaceChance > 0 && Random.nextFloat() < config.baseReplaceChance) {
|
||||
final BlockState baseState = config.baseState.get();
|
||||
BlockPos pos;
|
||||
for (Direction direction : Direction.Plane.HORIZONTAL) {
|
||||
if (randomSource.nextFloat() > config.chanceOfDirectionalSpread) continue;
|
||||
if (Random.nextFloat() > config.chanceOfDirectionalSpread) continue;
|
||||
pos = blockPos.relative(direction);
|
||||
placeBaseBlockIfPossible(levelAccessor, pos, baseState);
|
||||
|
||||
if (randomSource.nextFloat() > config.chanceOfSpreadRadius2) continue;
|
||||
pos = pos.relative(Direction.getRandom(randomSource));
|
||||
if (Random.nextFloat() > config.chanceOfSpreadRadius2) continue;
|
||||
pos = pos.relative(Direction.getRandom(Random));
|
||||
placeBaseBlockIfPossible(levelAccessor, pos, baseState);
|
||||
|
||||
if (randomSource.nextFloat() > config.chanceOfSpreadRadius3) continue;
|
||||
pos = pos.relative(Direction.getRandom(randomSource));
|
||||
if (Random.nextFloat() > config.chanceOfSpreadRadius3) continue;
|
||||
pos = pos.relative(Direction.getRandom(Random));
|
||||
placeBaseBlockIfPossible(levelAccessor, pos, baseState);
|
||||
}
|
||||
placeBaseBlockIfPossible(levelAccessor, blockPos, baseState);
|
||||
|
@ -222,7 +222,7 @@ public class ScatterFeature<FC extends ScatterFeatureConfig>
|
|||
public boolean grow(
|
||||
ServerLevelAccessor level,
|
||||
BlockPos origin,
|
||||
RandomSource random,
|
||||
Random random,
|
||||
FC config
|
||||
) {
|
||||
Optional<Direction> oDirection = getTipDirection(level, origin, random, config);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
package org.betterx.bclib.api.v2.levelgen.features.features;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
|
@ -10,6 +9,8 @@ import net.minecraft.world.level.levelgen.feature.WeightedPlacedFeature;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.RandomFeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public class WeightedRandomSelectorFeature extends Feature<RandomFeatureConfiguration> {
|
||||
|
@ -21,7 +22,7 @@ public class WeightedRandomSelectorFeature extends Feature<RandomFeatureConfigur
|
|||
final WorldGenLevel level = ctx.level();
|
||||
final ChunkGenerator generator = ctx.chunkGenerator();
|
||||
final RandomFeatureConfiguration cfg = ctx.config();
|
||||
final RandomSource random = ctx.random();
|
||||
final Random random = ctx.random();
|
||||
final BlockPos pos = ctx.origin();
|
||||
|
||||
PlacedFeature selected = cfg.defaultFeature.value();
|
||||
|
|
|
@ -3,12 +3,13 @@ package org.betterx.bclib.api.v2.levelgen.features.placement;
|
|||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementFilter;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* Tests if there is air at two locations above the tested block position
|
||||
*/
|
||||
|
@ -62,7 +63,7 @@ public class IsEmptyAboveSampledFilter extends PlacementFilter {
|
|||
|
||||
|
||||
@Override
|
||||
protected boolean shouldPlace(PlacementContext ctx, RandomSource random, BlockPos pos) {
|
||||
protected boolean shouldPlace(PlacementContext ctx, Random random, BlockPos pos) {
|
||||
WorldGenLevel level = ctx.getLevel();
|
||||
return level.isEmptyBlock(pos.above(distance1))
|
||||
&& (distance1 == distance2 || level.isEmptyBlock(pos.above(distance2)));
|
||||
|
|
|
@ -6,12 +6,13 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementFilter;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@Deprecated(forRemoval = true)
|
||||
public class MinEmptyFilter extends PlacementFilter {
|
||||
private static final MinEmptyFilter DOWN = new MinEmptyFilter(Direction.DOWN, 2);
|
||||
|
@ -48,7 +49,7 @@ public class MinEmptyFilter extends PlacementFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldPlace(PlacementContext ctx, RandomSource randomSource, BlockPos pos) {
|
||||
protected boolean shouldPlace(PlacementContext ctx, Random Random, BlockPos pos) {
|
||||
return BlocksHelper.isFreeSpace(
|
||||
ctx.getLevel(),
|
||||
pos.relative(direction),
|
||||
|
|
|
@ -7,19 +7,18 @@ import net.minecraft.resources.ResourceLocation;
|
|||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
import net.minecraft.world.level.levelgen.structure.TerrainAdjustment;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.structure.placement.RandomSpreadStructurePlacement;
|
||||
import net.minecraft.world.level.levelgen.structure.placement.RandomSpreadType;
|
||||
import net.minecraft.world.level.levelgen.structure.placement.StructurePlacement;
|
||||
|
||||
import java.util.function.Function;
|
||||
|
||||
public class BCLStructureBuilder<S extends Structure> {
|
||||
public class BCLStructureBuilder<S extends StructureFeature> {
|
||||
private static final BCLStructureBuilder INSTANCE = new BCLStructureBuilder();
|
||||
|
||||
private ResourceLocation structureID;
|
||||
private Function<Structure.StructureSettings, S> structureBuilder;
|
||||
private Function<StructureSettings, S> structureBuilder;
|
||||
|
||||
private GenerationStep.Decoration step;
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import net.minecraft.nbt.CompoundTag;
|
|||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
|
@ -23,6 +22,7 @@ import com.google.common.collect.Maps;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class StructureNBT {
|
||||
public final ResourceLocation location;
|
||||
|
@ -39,11 +39,11 @@ public class StructureNBT {
|
|||
this.structure = structure;
|
||||
}
|
||||
|
||||
public static Rotation getRandomRotation(RandomSource random) {
|
||||
public static Rotation getRandomRotation(Random random) {
|
||||
return Rotation.getRandom(random);
|
||||
}
|
||||
|
||||
public static Mirror getRandomMirror(RandomSource random) {
|
||||
public static Mirror getRandomMirror(Random random) {
|
||||
return Mirror.values()[random.nextInt(3)];
|
||||
}
|
||||
|
||||
|
|
|
@ -7,7 +7,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
@ -18,6 +17,7 @@ import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
|||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class StructureWorldNBT extends StructureNBT {
|
||||
public static final Codec<StructureWorldNBT> CODEC =
|
||||
|
@ -76,7 +76,7 @@ public class StructureWorldNBT extends StructureNBT {
|
|||
public boolean generateIfPlaceable(
|
||||
ServerLevelAccessor level,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
return generateIfPlaceable(
|
||||
level,
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
|
@ -15,9 +14,11 @@ import net.minecraft.world.level.levelgen.structure.TemplateStructurePiece;
|
|||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceSerializationContext;
|
||||
import net.minecraft.world.level.levelgen.structure.pieces.StructurePieceType;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.BlockIgnoreProcessor;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureManager;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplateManager;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TemplatePiece extends TemplateStructurePiece {
|
||||
public static final StructurePieceType INSTANCE = setTemplatePieceId(
|
||||
|
@ -43,7 +44,7 @@ public class TemplatePiece extends TemplateStructurePiece {
|
|||
|
||||
|
||||
public TemplatePiece(
|
||||
StructureTemplateManager structureTemplateManager,
|
||||
StructureManager structureTemplateManager,
|
||||
ResourceLocation resourceLocation,
|
||||
BlockPos centerPos,
|
||||
Rotation rotation,
|
||||
|
@ -61,7 +62,7 @@ public class TemplatePiece extends TemplateStructurePiece {
|
|||
);
|
||||
}
|
||||
|
||||
public TemplatePiece(StructureTemplateManager structureTemplateManager, CompoundTag compoundTag) {
|
||||
public TemplatePiece(StructureManager structureTemplateManager, CompoundTag compoundTag) {
|
||||
super(
|
||||
INSTANCE,
|
||||
compoundTag,
|
||||
|
@ -114,7 +115,7 @@ public class TemplatePiece extends TemplateStructurePiece {
|
|||
String string,
|
||||
BlockPos blockPos,
|
||||
ServerLevelAccessor serverLevelAccessor,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
BoundingBox boundingBox
|
||||
) {
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.ExtraCodecs;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.ChunkPos;
|
||||
import net.minecraft.world.level.NoiseColumn;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
|
@ -13,6 +12,7 @@ import net.minecraft.world.level.block.Mirror;
|
|||
import net.minecraft.world.level.block.Rotation;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.WorldGenerationContext;
|
||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||
import net.minecraft.world.level.levelgen.structure.BoundingBox;
|
||||
import net.minecraft.world.level.levelgen.structure.Structure;
|
||||
import net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate;
|
||||
|
@ -21,11 +21,12 @@ import com.google.common.collect.ImmutableList;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.BiPredicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
public abstract class TemplateStructure extends Structure {
|
||||
public abstract class TemplateStructure extends StructureFeature {
|
||||
protected final List<Config> configs;
|
||||
|
||||
public static <T extends TemplateStructure> Codec<T> simpleTemplateCodec(BiFunction<StructureSettings, List<Config>, T> instancer) {
|
||||
|
@ -59,7 +60,7 @@ public abstract class TemplateStructure extends Structure {
|
|||
this.configs = configs;
|
||||
}
|
||||
|
||||
protected Config randomConfig(RandomSource random) {
|
||||
protected Config randomConfig(Random random) {
|
||||
if (this.configs.size() > 1) {
|
||||
final float chanceSum = configs.parallelStream().map(c -> c.chance()).reduce(0.0f, (p, c) -> p + c);
|
||||
float rnd = random.nextFloat() * chanceSum;
|
||||
|
|
|
@ -8,13 +8,13 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.util.KeyDispatchDataCodec;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.valueproviders.FloatProvider;
|
||||
import net.minecraft.util.valueproviders.UniformFloat;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class RoughNoiseCondition implements SurfaceRules.ConditionSource {
|
||||
public static final Codec<RoughNoiseCondition> CODEC = RecordCodecBuilder.create(instance -> instance
|
||||
.group(
|
||||
|
@ -33,8 +33,6 @@ public class RoughNoiseCondition implements SurfaceRules.ConditionSource {
|
|||
)
|
||||
));
|
||||
|
||||
public static final KeyDispatchDataCodec<RoughNoiseCondition> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||
|
||||
private final ResourceKey<NormalNoise.NoiseParameters> noise;
|
||||
private final double minThreshold;
|
||||
private final double maxThreshold;
|
||||
|
@ -77,15 +75,15 @@ public class RoughNoiseCondition implements SurfaceRules.ConditionSource {
|
|||
}
|
||||
|
||||
@Override
|
||||
public KeyDispatchDataCodec<? extends SurfaceRules.ConditionSource> codec() {
|
||||
return KEY_CODEC;
|
||||
public Codec<? extends SurfaceRules.ConditionSource> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SurfaceRules.Condition apply(final SurfaceRules.Context context2) {
|
||||
final SurfaceRulesContextAccessor ctx = SurfaceRulesContextAccessor.class.cast(context2);
|
||||
final NormalNoise normalNoise = ctx.getRandomState().getOrCreateNoise(this.noise);
|
||||
final RandomSource roughnessSource = ctx.getRandomState()
|
||||
final Random roughnessSource = ctx.getRandomState()
|
||||
.getOrCreateRandomFactory(Noises.ROUGHNESS_NOISE.location())
|
||||
.fromHashOf(Noises.ROUGHNESS_NOISE.location());
|
||||
|
||||
|
|
|
@ -5,16 +5,15 @@ import org.betterx.bclib.noise.OpenSimplexNoise;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.util.KeyDispatchDataCodec;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.valueproviders.ConstantFloat;
|
||||
import net.minecraft.util.valueproviders.FloatProvider;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import net.minecraft.world.level.levelgen.ThreadSafeLegacyRandomSource;
|
||||
import net.minecraft.world.level.levelgen.ThreadSafeLegacyRandom;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class ThresholdCondition extends SurfaceNoiseCondition {
|
||||
private static final Map<Long, Context> NOISES = Maps.newHashMap();
|
||||
|
@ -27,7 +26,6 @@ public class ThresholdCondition extends SurfaceNoiseCondition {
|
|||
Codec.DOUBLE.fieldOf("scale_z").orElse(0.1).forGetter(p -> p.scaleZ)
|
||||
)
|
||||
.apply(instance, ThresholdCondition::new));
|
||||
public static final KeyDispatchDataCodec<ThresholdCondition> KEY_CODEC = KeyDispatchDataCodec.of(CODEC);
|
||||
private final Context noiseContext;
|
||||
private final double threshold;
|
||||
private final FloatProvider range;
|
||||
|
@ -58,13 +56,13 @@ public class ThresholdCondition extends SurfaceNoiseCondition {
|
|||
}
|
||||
|
||||
@Override
|
||||
public KeyDispatchDataCodec<? extends SurfaceRules.ConditionSource> codec() {
|
||||
return KEY_CODEC;
|
||||
public Codec<? extends SurfaceRules.ConditionSource> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
|
||||
static class Context {
|
||||
public final OpenSimplexNoise noise;
|
||||
public final RandomSource random;
|
||||
public final Random random;
|
||||
public final long seed;
|
||||
|
||||
public double lastX = Integer.MIN_VALUE;
|
||||
|
@ -74,7 +72,7 @@ public class ThresholdCondition extends SurfaceNoiseCondition {
|
|||
Context(long seed) {
|
||||
this.seed = seed;
|
||||
this.noise = new OpenSimplexNoise(seed);
|
||||
this.random = new ThreadSafeLegacyRandomSource(seed * 2);
|
||||
this.random = new ThreadSafeLegacyRandom(seed * 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,15 +6,15 @@ import org.betterx.bclib.noise.OpenSimplexNoise;
|
|||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.util.KeyDispatchDataCodec;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.valueproviders.ConstantFloat;
|
||||
import net.minecraft.util.valueproviders.FloatProvider;
|
||||
import net.minecraft.world.level.levelgen.SurfaceRules;
|
||||
import net.minecraft.world.level.levelgen.ThreadSafeLegacyRandomSource;
|
||||
import net.minecraft.world.level.levelgen.ThreadSafeLegacyRandom;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class VolumeThresholdCondition extends VolumeNoiseCondition {
|
||||
private static final Map<Long, VolumeThresholdCondition.Context> NOISES = Maps.newHashMap();
|
||||
|
@ -89,7 +89,7 @@ public class VolumeThresholdCondition extends VolumeNoiseCondition {
|
|||
|
||||
public static class Context {
|
||||
public final OpenSimplexNoise noise;
|
||||
public final RandomSource random;
|
||||
public final Random random;
|
||||
public final long seed;
|
||||
|
||||
double lastX = Integer.MIN_VALUE;
|
||||
|
@ -100,7 +100,7 @@ public class VolumeThresholdCondition extends VolumeNoiseCondition {
|
|||
Context(long seed) {
|
||||
this.seed = seed;
|
||||
this.noise = new OpenSimplexNoise(seed);
|
||||
this.random = new ThreadSafeLegacyRandomSource(seed * 3 + 1);
|
||||
this.random = new ThreadSafeLegacyRandom(seed * 3 + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,12 +3,12 @@ package org.betterx.bclib.api.v2.spawning;
|
|||
import org.betterx.bclib.interfaces.SpawnRule;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
|
||||
import java.util.Random;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class SpawnRuleEntry<M extends Mob> implements Comparable<SpawnRuleEntry> {
|
||||
|
@ -25,7 +25,7 @@ public class SpawnRuleEntry<M extends Mob> implements Comparable<SpawnRuleEntry>
|
|||
LevelAccessor world,
|
||||
MobSpawnType spawnReason,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
return rule.canSpawn(type, world, spawnReason, pos, random);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
|
@ -15,6 +14,7 @@ import net.minecraft.world.level.levelgen.feature.configurations.RandomPatchConf
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public class BCLConfigureFeature<F extends Feature<FC>, FC extends FeatureConfiguration> {
|
||||
private static final Map<Holder<ConfiguredFeature<?, ?>>, BCLConfigureFeature<?, ?>> KNOWN = new HashMap<>();
|
||||
|
@ -54,7 +54,7 @@ public class BCLConfigureFeature<F extends Feature<FC>, FC extends FeatureConfig
|
|||
);
|
||||
}
|
||||
|
||||
public boolean placeInWorld(ServerLevel level, BlockPos pos, RandomSource random) {
|
||||
public boolean placeInWorld(ServerLevel level, BlockPos pos, Random random) {
|
||||
return placeInWorld(getFeature(), getConfiguration(), level, pos, random);
|
||||
}
|
||||
|
||||
|
@ -63,7 +63,7 @@ public class BCLConfigureFeature<F extends Feature<FC>, FC extends FeatureConfig
|
|||
FeatureConfiguration config,
|
||||
ServerLevel level,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
if (config instanceof RandomPatchConfiguration rnd) {
|
||||
var configured = rnd.feature().value().feature().value();
|
||||
|
@ -90,7 +90,7 @@ public class BCLConfigureFeature<F extends Feature<FC>, FC extends FeatureConfig
|
|||
Feature<NoneFeatureConfiguration> feature,
|
||||
ServerLevel level,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
return placeUnboundInWorld(feature, FeatureConfiguration.NONE, level, pos, random);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class BCLConfigureFeature<F extends Feature<FC>, FC extends FeatureConfig
|
|||
FC config,
|
||||
ServerLevel level,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
return placeUnboundInWorld(feature, config, level, pos, random);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
package org.betterx.bclib.api.v3.levelgen.features;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.ServerLevelAccessor;
|
||||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public interface UserGrowableFeature<FC extends FeatureConfiguration> {
|
||||
boolean grow(
|
||||
ServerLevelAccessor level,
|
||||
BlockPos pos,
|
||||
RandomSource random,
|
||||
Random random,
|
||||
FC configuration
|
||||
);
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.StringRepresentable;
|
||||
import net.minecraft.util.valueproviders.IntProvider;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
|
@ -15,10 +14,12 @@ import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
|||
import net.minecraft.world.level.levelgen.feature.configurations.FeatureConfiguration;
|
||||
import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvider;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PillarFeatureConfig implements FeatureConfiguration {
|
||||
@FunctionalInterface
|
||||
public interface StateTransform {
|
||||
BlockState apply(int height, int maxHeight, BlockState inputState, BlockPos pos, RandomSource rnd);
|
||||
BlockState apply(int height, int maxHeight, BlockState inputState, BlockPos pos, Random rnd);
|
||||
}
|
||||
|
||||
@FunctionalInterface
|
||||
|
@ -31,7 +32,7 @@ public class PillarFeatureConfig implements FeatureConfiguration {
|
|||
BlockPos abovePos,
|
||||
WorldGenLevel level,
|
||||
BlockPredicate allowedPlacement,
|
||||
RandomSource rnd
|
||||
Random rnd
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -129,7 +130,7 @@ public class PillarFeatureConfig implements FeatureConfiguration {
|
|||
this.allowedPlacement = allowedPlacement;
|
||||
}
|
||||
|
||||
public BlockState transform(int currentHeight, int maxHeight, BlockPos pos, RandomSource rnd) {
|
||||
public BlockState transform(int currentHeight, int maxHeight, BlockPos pos, Random rnd) {
|
||||
BlockState state = stateProvider.getState(rnd, pos);
|
||||
return transformer.stateTransform.apply(currentHeight, maxHeight, state, pos, rnd);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.betterx.bclib.api.v3.levelgen.features.config;
|
|||
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.random.SimpleWeightedRandomList;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -13,6 +12,7 @@ import net.minecraft.world.level.levelgen.feature.stateproviders.BlockStateProvi
|
|||
import net.minecraft.world.level.levelgen.feature.stateproviders.WeightedStateProvider;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class PlaceBlockFeatureConfig implements FeatureConfiguration {
|
||||
|
||||
|
@ -59,7 +59,7 @@ public abstract class PlaceBlockFeatureConfig implements FeatureConfiguration {
|
|||
this.stateProvider = blocks;
|
||||
}
|
||||
|
||||
public BlockState getRandomBlock(RandomSource random, BlockPos pos) {
|
||||
public BlockState getRandomBlock(Random random, BlockPos pos) {
|
||||
return this.stateProvider.getState(random, pos);
|
||||
}
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import org.betterx.bclib.api.v3.levelgen.features.config.ConditionFeatureConfig;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
|
@ -12,6 +11,7 @@ import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
|||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ConditionFeature extends Feature<ConditionFeatureConfig> {
|
||||
|
@ -23,7 +23,7 @@ public class ConditionFeature extends Feature<ConditionFeatureConfig> {
|
|||
public boolean place(FeaturePlaceContext<ConditionFeatureConfig> ctx) {
|
||||
final ConditionFeatureConfig cfg = ctx.config();
|
||||
final WorldGenLevel level = ctx.level();
|
||||
final RandomSource random = ctx.random();
|
||||
final Random random = ctx.random();
|
||||
final BlockPos pos = ctx.origin();
|
||||
|
||||
final PlacementContext c = new PlacementContext(level, ctx.chunkGenerator(), Optional.empty());
|
||||
|
|
|
@ -4,12 +4,13 @@ import org.betterx.bclib.api.v3.levelgen.features.config.PillarFeatureConfig;
|
|||
import org.betterx.bclib.util.BlocksHelper;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class PillarFeature extends Feature<PillarFeatureConfig> {
|
||||
public PillarFeature() {
|
||||
super(PillarFeatureConfig.CODEC);
|
||||
|
@ -21,7 +22,7 @@ public class PillarFeature extends Feature<PillarFeatureConfig> {
|
|||
int height;
|
||||
final WorldGenLevel level = featurePlaceContext.level();
|
||||
final PillarFeatureConfig config = featurePlaceContext.config();
|
||||
final RandomSource rnd = featurePlaceContext.random();
|
||||
final Random rnd = featurePlaceContext.random();
|
||||
int maxHeight = config.maxHeight.sample(rnd);
|
||||
int minHeight = config.minHeight.sample(rnd);
|
||||
BlockPos.MutableBlockPos posnow = featurePlaceContext.origin().mutable();
|
||||
|
|
|
@ -8,11 +8,12 @@ import org.betterx.bclib.api.v3.levelgen.features.config.TemplateFeatureConfig;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep;
|
||||
import net.minecraft.world.level.levelgen.feature.Feature;
|
||||
import net.minecraft.world.level.levelgen.feature.FeaturePlaceContext;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class TemplateFeature<FC extends TemplateFeatureConfig> extends Feature<FC> {
|
||||
|
||||
public static <T extends TemplateFeatureConfig> BCLFeature createAndRegisterRare(
|
||||
|
@ -57,7 +58,7 @@ public class TemplateFeature<FC extends TemplateFeatureConfig> extends Feature<F
|
|||
super(codec);
|
||||
}
|
||||
|
||||
protected StructureWorldNBT randomStructure(TemplateFeatureConfig cfg, RandomSource random) {
|
||||
protected StructureWorldNBT randomStructure(TemplateFeatureConfig cfg, Random random) {
|
||||
|
||||
if (cfg.structures.size() > 1) {
|
||||
final float chanceSum = cfg.structures.parallelStream().map(c -> c.chance).reduce(0.0f, (p, c) -> p + c);
|
||||
|
|
|
@ -2,11 +2,11 @@ package org.betterx.bclib.api.v3.levelgen.features.placement;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
|
@ -17,7 +17,7 @@ public class All extends PlacementModifier {
|
|||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext placementContext,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
BlockPos blockPos
|
||||
) {
|
||||
return IntStream.range(0, 16 * 16 - 1).mapToObj(i -> blockPos.offset(i & 0xF, 0, i >> 4));
|
||||
|
|
|
@ -2,11 +2,11 @@ package org.betterx.bclib.api.v3.levelgen.features.placement;
|
|||
|
||||
import com.mojang.serialization.Codec;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Debug extends PlacementModifier {
|
||||
|
@ -16,7 +16,7 @@ public class Debug extends PlacementModifier {
|
|||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext placementContext,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
BlockPos blockPos
|
||||
) {
|
||||
return Stream.of(blockPos);
|
||||
|
|
|
@ -4,13 +4,13 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.valueproviders.IntProvider;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Extend extends PlacementModifier {
|
||||
|
@ -38,7 +38,7 @@ public class Extend extends PlacementModifier {
|
|||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext placementContext,
|
||||
RandomSource random,
|
||||
Random random,
|
||||
BlockPos blockPos
|
||||
) {
|
||||
var builder = Stream.<BlockPos>builder();
|
||||
|
|
|
@ -8,7 +8,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.SectionPos;
|
||||
import net.minecraft.util.ExtraCodecs;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.util.valueproviders.IntProvider;
|
||||
import net.minecraft.util.valueproviders.UniformInt;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
|
@ -16,6 +15,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
|||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class FindSolidInDirection extends PlacementModifier {
|
||||
|
@ -93,19 +93,19 @@ public class FindSolidInDirection extends PlacementModifier {
|
|||
return new FindSolidInDirection(Direction.UP, dist, offset);
|
||||
}
|
||||
|
||||
public Direction randomDirection(RandomSource random) {
|
||||
public Direction randomDirection(Random random) {
|
||||
return direction.get(provider.sample(random));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext placementContext,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
BlockPos blockPos
|
||||
) {
|
||||
var builder = Stream.<BlockPos>builder();
|
||||
if (randomSelect) {
|
||||
submitSingle(placementContext, blockPos, builder, randomDirection(randomSource));
|
||||
submitSingle(placementContext, blockPos, builder, randomDirection(Random));
|
||||
} else {
|
||||
for (Direction d : direction) {
|
||||
submitSingle(placementContext, blockPos, builder, d);
|
||||
|
|
|
@ -4,12 +4,12 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.ExtraCodecs;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ForAll extends PlacementModifier {
|
||||
|
@ -30,12 +30,12 @@ public class ForAll extends PlacementModifier {
|
|||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext placementContext,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
BlockPos blockPos
|
||||
) {
|
||||
Stream.Builder<BlockPos> stream = Stream.builder();
|
||||
for (PlacementModifier p : modifiers) {
|
||||
p.getPositions(placementContext, randomSource, blockPos).forEach(pp -> stream.add(pp));
|
||||
p.getPositions(placementContext, Random, blockPos).forEach(pp -> stream.add(pp));
|
||||
}
|
||||
return stream.build();
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
|
@ -13,6 +12,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementFilter;
|
|||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public class Is extends PlacementFilter {
|
||||
public static final Codec<Is> CODEC = RecordCodecBuilder.create((instance) -> instance
|
||||
|
@ -47,7 +47,7 @@ public class Is extends PlacementFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldPlace(PlacementContext ctx, RandomSource random, BlockPos pos) {
|
||||
protected boolean shouldPlace(PlacementContext ctx, Random random, BlockPos pos) {
|
||||
WorldGenLevel level = ctx.getLevel();
|
||||
return predicate.test(level, offset.map(v -> pos.offset(v.getX(), v.getY(), v.getZ())).orElse(pos));
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ package org.betterx.bclib.api.v3.levelgen.features.placement;
|
|||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
|
@ -11,6 +10,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementFilter;
|
|||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
|
||||
public class IsBasin extends PlacementFilter {
|
||||
public static final Codec<IsBasin> CODEC = RecordCodecBuilder.create((instance) -> instance
|
||||
|
@ -46,7 +46,7 @@ public class IsBasin extends PlacementFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldPlace(PlacementContext ctx, RandomSource random, BlockPos pos) {
|
||||
protected boolean shouldPlace(PlacementContext ctx, Random random, BlockPos pos) {
|
||||
WorldGenLevel level = ctx.getLevel();
|
||||
if (topPredicate.isPresent() && !topPredicate.get().test(level, pos.above())) return false;
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.levelgen.blockpredicates.BlockPredicate;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
|
@ -12,6 +11,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementFilter;
|
|||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class IsNextTo extends PlacementFilter {
|
||||
|
@ -47,7 +47,7 @@ public class IsNextTo extends PlacementFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldPlace(PlacementContext ctx, RandomSource random, BlockPos pos) {
|
||||
protected boolean shouldPlace(PlacementContext ctx, Random random, BlockPos pos) {
|
||||
WorldGenLevel level = ctx.getLevel();
|
||||
|
||||
pos = pos.offset(this.offset);
|
||||
|
|
|
@ -7,12 +7,13 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementFilter;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public class NoiseFilter extends PlacementFilter {
|
||||
public static final Codec<NoiseFilter> CODEC = RecordCodecBuilder.create(instance -> instance
|
||||
.group(
|
||||
|
@ -47,7 +48,7 @@ public class NoiseFilter extends PlacementFilter {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldPlace(PlacementContext ctx, RandomSource random, BlockPos pos) {
|
||||
protected boolean shouldPlace(PlacementContext ctx, Random random, BlockPos pos) {
|
||||
final NormalNoise normalNoise = Noises.getOrCreateNoise(ctx.getLevel().registryAccess(), random, this.noise);
|
||||
final double v = normalNoise.getValue(pos.getX() * scaleXZ, pos.getY() * scaleY, pos.getZ() * scaleXZ);
|
||||
return v > minNoiseLevel && v < maxNoiseLevel;
|
||||
|
|
|
@ -5,7 +5,6 @@ import com.mojang.serialization.codecs.RecordCodecBuilder;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
@ -13,6 +12,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
|||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Offset extends PlacementModifier {
|
||||
|
@ -38,7 +38,7 @@ public class Offset extends PlacementModifier {
|
|||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext placementContext,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
BlockPos blockPos
|
||||
) {
|
||||
return Stream.of(blockPos.offset(offset));
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.betterx.bclib.util.BlocksHelper;
|
|||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
@ -14,6 +13,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
|||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class OnEveryLayer
|
||||
|
@ -47,7 +47,7 @@ public class OnEveryLayer
|
|||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext ctx,
|
||||
RandomSource random,
|
||||
Random random,
|
||||
BlockPos pos
|
||||
) {
|
||||
|
||||
|
|
|
@ -4,7 +4,6 @@ import com.mojang.serialization.Codec;
|
|||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.ExtraCodecs;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementContext;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
@ -12,6 +11,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class Stencil extends PlacementModifier {
|
||||
|
@ -46,7 +46,7 @@ public class Stencil extends PlacementModifier {
|
|||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext placementContext,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
BlockPos blockPos
|
||||
) {
|
||||
List<BlockPos> pos = new ArrayList<>(16 * 16);
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.betterx.bclib.util.BlocksHelper;
|
|||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.levelgen.Heightmap;
|
||||
|
@ -14,6 +13,7 @@ import net.minecraft.world.level.levelgen.placement.PlacementModifier;
|
|||
import net.minecraft.world.level.levelgen.placement.PlacementModifierType;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class UnderEveryLayer
|
||||
|
@ -47,7 +47,7 @@ public class UnderEveryLayer
|
|||
@Override
|
||||
public Stream<BlockPos> getPositions(
|
||||
PlacementContext ctx,
|
||||
RandomSource random,
|
||||
Random random,
|
||||
BlockPos pos
|
||||
) {
|
||||
|
||||
|
|
|
@ -10,7 +10,6 @@ import org.betterx.bclib.items.BaseAnvilItem;
|
|||
import net.minecraft.client.renderer.block.model.BlockModel;
|
||||
import net.minecraft.client.resources.model.UnbakedModel;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.BlockItem;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.PickaxeItem;
|
||||
|
@ -33,10 +32,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelProvider, CustomItemProvider {
|
||||
|
@ -124,7 +120,7 @@ public abstract class BaseAnvilBlock extends AnvilBlock implements BlockModelPro
|
|||
return 3;
|
||||
}
|
||||
|
||||
public BlockState damageAnvilUse(BlockState state, RandomSource random) {
|
||||
public BlockState damageAnvilUse(BlockState state, Random random) {
|
||||
IntegerProperty durability = getDurabilityProp();
|
||||
int value = state.getValue(durability);
|
||||
if (value < getMaxDurability() && random.nextInt(8) == 0) {
|
||||
|
|
|
@ -15,7 +15,6 @@ import net.minecraft.core.Direction;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.stats.Stats;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
|
@ -39,6 +38,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider {
|
||||
|
@ -87,7 +87,7 @@ public class BaseBarrelBlock extends BarrelBlock implements BlockModelProvider {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
BlockEntity blockEntity = world.getBlockEntity(pos);
|
||||
if (blockEntity instanceof BaseBarrelBlockEntity) {
|
||||
((BaseBarrelBlockEntity) blockEntity).recheckOpen();
|
||||
|
|
|
@ -6,7 +6,6 @@ import org.betterx.bclib.util.MHelper;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
|
@ -27,6 +26,7 @@ import com.google.common.collect.Lists;
|
|||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class BaseCropBlock extends BasePlantBlock {
|
||||
public static final IntegerProperty AGE = IntegerProperty.create("age", 0, 3);
|
||||
|
@ -81,7 +81,7 @@ public class BaseCropBlock extends BasePlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public void performBonemeal(ServerLevel level, Random random, BlockPos pos, BlockState state) {
|
||||
int age = state.getValue(AGE);
|
||||
if (age < 3) {
|
||||
BlocksHelper.setWithUpdate(level, pos, state.setValue(AGE, age + 1));
|
||||
|
@ -94,13 +94,13 @@ public class BaseCropBlock extends BasePlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public boolean isBonemealSuccess(Level level, Random random, BlockPos pos, BlockState state) {
|
||||
return state.getValue(AGE) < 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
super.tick(state, world, pos, random);
|
||||
if (isBonemealSuccess(world, random, pos, state) && random.nextInt(8) == 0) {
|
||||
performBonemeal(world, random, pos, state);
|
||||
|
|
|
@ -8,7 +8,6 @@ import org.betterx.bclib.util.BlocksHelper;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.LivingEntity;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
@ -39,6 +38,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements RenderLayerProvider, BonemealableBlock {
|
||||
private static final VoxelShape SHAPE = box(4, 2, 4, 12, 16, 12);
|
||||
|
@ -142,12 +142,12 @@ public abstract class BaseDoublePlantBlock extends BaseBlockNotFull implements R
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public boolean isBonemealSuccess(Level level, Random random, BlockPos pos, BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public void performBonemeal(ServerLevel level, Random random, BlockPos pos, BlockState state) {
|
||||
ItemEntity item = new ItemEntity(
|
||||
level,
|
||||
pos.getX() + 0.5,
|
||||
|
|
|
@ -13,7 +13,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
|
@ -42,6 +41,7 @@ import com.google.common.collect.Lists;
|
|||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class BasePlantBlock extends BaseBlockNotFull implements RenderLayerProvider, BonemealableBlock {
|
||||
|
@ -175,12 +175,12 @@ public abstract class BasePlantBlock extends BaseBlockNotFull implements RenderL
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public boolean isBonemealSuccess(Level level, Random random, BlockPos pos, BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public void performBonemeal(ServerLevel level, Random random, BlockPos pos, BlockState state) {
|
||||
ItemEntity item = new ItemEntity(
|
||||
level,
|
||||
pos.getX() + 0.5,
|
||||
|
|
|
@ -2,7 +2,6 @@ package org.betterx.bclib.blocks;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
@ -10,6 +9,7 @@ import net.minecraft.world.level.block.state.BlockState;
|
|||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class BasePlantWithAgeBlock extends BasePlantBlock {
|
||||
|
@ -33,10 +33,10 @@ public abstract class BasePlantWithAgeBlock extends BasePlantBlock {
|
|||
stateManager.add(AGE);
|
||||
}
|
||||
|
||||
public abstract void growAdult(WorldGenLevel world, RandomSource random, BlockPos pos);
|
||||
public abstract void growAdult(WorldGenLevel world, Random random, BlockPos pos);
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public void performBonemeal(ServerLevel level, Random random, BlockPos pos, BlockState state) {
|
||||
int age = state.getValue(AGE);
|
||||
if (age < 3) {
|
||||
level.setBlockAndUpdate(pos, state.setValue(AGE, age + 1));
|
||||
|
@ -46,13 +46,13 @@ public abstract class BasePlantWithAgeBlock extends BasePlantBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public boolean isBonemealSuccess(Level level, Random random, BlockPos pos, BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
super.tick(state, world, pos, random);
|
||||
if (random.nextInt(8) == 0) {
|
||||
performBonemeal(world, random, pos, state);
|
||||
|
|
|
@ -17,7 +17,6 @@ import net.minecraft.server.level.ServerLevel;
|
|||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -42,10 +41,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -103,7 +99,7 @@ public class BaseTerrainBlock extends BaseBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
if (random.nextInt(16) == 0 && !canStay(state, world, pos)) {
|
||||
world.setBlockAndUpdate(pos, getBaseBlock().defaultBlockState());
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.tags.BlockTags;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.Enchantments;
|
||||
|
@ -38,6 +37,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
|
@ -145,7 +145,7 @@ public class BaseVineBlock extends BaseBlockNotFull implements RenderLayerProvid
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public boolean isBonemealSuccess(Level level, Random random, BlockPos pos, BlockState state) {
|
||||
while (level.getBlockState(pos).getBlock() == this) {
|
||||
pos = pos.below();
|
||||
}
|
||||
|
@ -153,7 +153,7 @@ public class BaseVineBlock extends BaseBlockNotFull implements RenderLayerProvid
|
|||
}
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public void performBonemeal(ServerLevel level, Random random, BlockPos pos, BlockState state) {
|
||||
while (level.getBlockState(pos).getBlock() == this) {
|
||||
pos = pos.below();
|
||||
}
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.Level;
|
||||
|
@ -40,6 +39,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
@ -153,24 +153,24 @@ public class FeatureSaplingBlock<F extends Feature<FC>, FC extends FeatureConfig
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public boolean isBonemealSuccess(Level level, Random random, BlockPos pos, BlockState state) {
|
||||
return random.nextInt(16) == 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void advanceTree(ServerLevel world, BlockPos pos, BlockState blockState, RandomSource random) {
|
||||
public void advanceTree(ServerLevel world, BlockPos pos, BlockState blockState, Random random) {
|
||||
var conf = getConfiguredFeature(blockState);
|
||||
if (conf == null) getFeature(blockState).place(world, pos, random);
|
||||
else conf.placeInWorld(world, pos, random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
this.tick(state, world, pos, random);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
super.tick(state, world, pos, random);
|
||||
if (isBonemealSuccess(world, random, pos, state)) {
|
||||
performBonemeal(world, random, pos, state);
|
||||
|
|
|
@ -14,7 +14,6 @@ import net.minecraft.core.BlockPos;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
|
@ -38,6 +37,7 @@ import com.google.common.collect.Maps;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.Random;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class TripleTerrainBlock extends BaseTerrainBlock {
|
||||
|
@ -84,7 +84,7 @@ public class TripleTerrainBlock extends BaseTerrainBlock {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void randomTick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
TripleShape shape = state.getValue(SHAPE);
|
||||
if (shape == TripleShape.BOTTOM) {
|
||||
super.randomTick(state, world, pos, random);
|
||||
|
|
|
@ -7,7 +7,6 @@ import org.betterx.bclib.items.tool.BaseShearsItem;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.item.ItemEntity;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
|
@ -37,6 +36,7 @@ import net.fabricmc.fabric.api.object.builder.v1.block.FabricBlockSettings;
|
|||
import com.google.common.collect.Lists;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public abstract class UnderwaterPlantBlock extends BaseBlockNotFull implements RenderLayerProvider, BonemealableBlock, LiquidBlockContainer {
|
||||
|
@ -156,12 +156,12 @@ public abstract class UnderwaterPlantBlock extends BaseBlockNotFull implements R
|
|||
}
|
||||
|
||||
@Override
|
||||
public boolean isBonemealSuccess(Level level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public boolean isBonemealSuccess(Level level, Random random, BlockPos pos, BlockState state) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel level, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public void performBonemeal(ServerLevel level, Random random, BlockPos pos, BlockState state) {
|
||||
ItemEntity item = new ItemEntity(
|
||||
level,
|
||||
pos.getX() + 0.5,
|
||||
|
|
|
@ -2,13 +2,14 @@ package org.betterx.bclib.blocks;
|
|||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.server.level.ServerLevel;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
import net.minecraft.world.level.block.state.properties.IntegerProperty;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
public abstract class UnderwaterPlantWithAgeBlock extends UnderwaterPlantBlock {
|
||||
public static final IntegerProperty AGE = BlockProperties.AGE;
|
||||
|
||||
|
@ -21,10 +22,10 @@ public abstract class UnderwaterPlantWithAgeBlock extends UnderwaterPlantBlock {
|
|||
stateManager.add(AGE);
|
||||
}
|
||||
|
||||
public abstract void grow(WorldGenLevel world, RandomSource random, BlockPos pos);
|
||||
public abstract void grow(WorldGenLevel world, Random random, BlockPos pos);
|
||||
|
||||
@Override
|
||||
public void performBonemeal(ServerLevel world, RandomSource random, BlockPos pos, BlockState state) {
|
||||
public void performBonemeal(ServerLevel world, Random random, BlockPos pos, BlockState state) {
|
||||
if (random.nextInt(4) == 0) {
|
||||
int age = state.getValue(AGE);
|
||||
if (age < 3) {
|
||||
|
@ -37,7 +38,7 @@ public abstract class UnderwaterPlantWithAgeBlock extends UnderwaterPlantBlock {
|
|||
|
||||
@Override
|
||||
@SuppressWarnings("deprecation")
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource random) {
|
||||
public void tick(BlockState state, ServerLevel world, BlockPos pos, Random random) {
|
||||
super.tick(state, world, pos, random);
|
||||
if (isBonemealSuccess(world, random, pos, state)) {
|
||||
performBonemeal(world, random, pos, state);
|
||||
|
|
|
@ -16,7 +16,6 @@ import net.minecraft.client.resources.model.*;
|
|||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.Resource;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
|
@ -121,7 +120,7 @@ public class OBJBlockModel implements UnbakedModel, BakedModel {
|
|||
public List<BakedQuad> getQuads(
|
||||
@Nullable BlockState blockState,
|
||||
@Nullable Direction direction,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
return direction == null ? quadsBaked : quadsBakedMap.get(direction);
|
||||
}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
package org.betterx.bclib.interfaces;
|
||||
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.Mob;
|
||||
import net.minecraft.world.entity.MobSpawnType;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
@FunctionalInterface
|
||||
public interface SpawnRule<M extends Mob> {
|
||||
boolean canSpawn(
|
||||
|
@ -14,6 +15,6 @@ public interface SpawnRule<M extends Mob> {
|
|||
LevelAccessor world,
|
||||
MobSpawnType spawnReason,
|
||||
BlockPos pos,
|
||||
RandomSource random
|
||||
Random random
|
||||
);
|
||||
}
|
||||
|
|
|
@ -7,11 +7,11 @@ import net.minecraft.core.Registry;
|
|||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
public class Noises {
|
||||
private static final Map<ResourceKey<NormalNoise.NoiseParameters>, NormalNoise> noiseIntances = new HashMap<>();
|
||||
|
@ -24,19 +24,19 @@ public class Noises {
|
|||
|
||||
public static NormalNoise createNoise(
|
||||
Registry<NormalNoise.NoiseParameters> registry,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
ResourceKey<NormalNoise.NoiseParameters> resourceKey
|
||||
) {
|
||||
Holder<NormalNoise.NoiseParameters> holder = registry.getHolderOrThrow(resourceKey);
|
||||
return NormalNoise.create(randomSource, holder.value());
|
||||
return NormalNoise.create(Random, holder.value());
|
||||
}
|
||||
|
||||
public static NormalNoise getOrCreateNoise(
|
||||
RegistryAccess registryAccess,
|
||||
RandomSource randomSource,
|
||||
Random Random,
|
||||
ResourceKey<NormalNoise.NoiseParameters> noise
|
||||
) {
|
||||
final Registry<NormalNoise.NoiseParameters> registry = registryAccess.registryOrThrow(Registry.NOISE_REGISTRY);
|
||||
return noiseIntances.computeIfAbsent(noise, (key) -> createNoise(registry, randomSource, noise));
|
||||
return noiseIntances.computeIfAbsent(noise, (key) -> createNoise(registry, Random, noise));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ import org.betterx.worlds.together.tag.v3.CommonBlockTags;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.BlockGetter;
|
||||
import net.minecraft.world.level.ClipContext.Fluid;
|
||||
import net.minecraft.world.level.LevelAccessor;
|
||||
|
@ -157,7 +156,7 @@ public class BlocksHelper {
|
|||
* @param random - {@link Random}.
|
||||
* @return {@link Direction}.
|
||||
*/
|
||||
public static Direction randomHorizontal(RandomSource random) {
|
||||
public static Direction randomHorizontal(Random random) {
|
||||
return HORIZONTAL[random.nextInt(4)];
|
||||
}
|
||||
|
||||
|
@ -167,7 +166,7 @@ public class BlocksHelper {
|
|||
* @param random - {@link Random}.
|
||||
* @return {@link Direction}.
|
||||
*/
|
||||
public static Direction randomDirection(RandomSource random) {
|
||||
public static Direction randomDirection(Random random) {
|
||||
return DIRECTIONS[random.nextInt(6)];
|
||||
}
|
||||
|
||||
|
|
|
@ -2,8 +2,7 @@ package org.betterx.bclib.util;
|
|||
|
||||
import com.mojang.math.Vector3f;
|
||||
import net.minecraft.core.Vec3i;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.levelgen.LegacyRandomSource;
|
||||
import net.minecraft.world.level.levelgen.LegacyRandom;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
|
@ -13,17 +12,17 @@ public class MHelper {
|
|||
public static final float PHI = (float) (Math.PI * (3 - Math.sqrt(5)));
|
||||
public static final float PI2 = (float) (Math.PI * 2);
|
||||
public static final Random RANDOM = new Random();
|
||||
public static final RandomSource RANDOM_SOURCE = new LegacyRandomSource(RANDOM.nextLong());
|
||||
public static final Random RANDOM_SOURCE = new LegacyRandom(RANDOM.nextLong());
|
||||
|
||||
public static int randRange(int min, int max, RandomSource random) {
|
||||
public static int randRange(int min, int max, Random random) {
|
||||
return min + random.nextInt(max - min + 1);
|
||||
}
|
||||
|
||||
public static double randRange(double min, double max, RandomSource random) {
|
||||
public static double randRange(double min, double max, Random random) {
|
||||
return min + random.nextDouble() * (max - min);
|
||||
}
|
||||
|
||||
public static float randRange(float min, float max, RandomSource random) {
|
||||
public static float randRange(float min, float max, Random random) {
|
||||
return min + random.nextFloat() * (max - min);
|
||||
}
|
||||
|
||||
|
@ -143,7 +142,7 @@ public class MHelper {
|
|||
return h ^ (h >> 16);
|
||||
}
|
||||
|
||||
public static <T> void shuffle(T[] array, RandomSource random) {
|
||||
public static <T> void shuffle(T[] array, Random random) {
|
||||
for (int i = 0; i < array.length; i++) {
|
||||
int i2 = random.nextInt(array.length);
|
||||
T element = array[i];
|
||||
|
@ -198,14 +197,14 @@ public class MHelper {
|
|||
return (float) Math.acos(dot / Math.sqrt(length1 * length2));
|
||||
}
|
||||
|
||||
public static Vector3f randomHorizontal(RandomSource random) {
|
||||
public static Vector3f randomHorizontal(Random random) {
|
||||
float angleY = randRange(0, PI2, random);
|
||||
float vx = (float) Math.sin(angleY);
|
||||
float vz = (float) Math.cos(angleY);
|
||||
return new Vector3f(vx, 0, vz);
|
||||
}
|
||||
|
||||
public static Vec3i[] getOffsets(RandomSource random) {
|
||||
public static Vec3i[] getOffsets(Random random) {
|
||||
shuffle(RANDOM_OFFSETS, random);
|
||||
return RANDOM_OFFSETS;
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ import com.mojang.math.Vector3f;
|
|||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.BlockPos.MutableBlockPos;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
|
||||
|
@ -16,6 +15,7 @@ import com.google.common.collect.Lists;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
import java.util.function.Function;
|
||||
|
||||
public class SplineHelper {
|
||||
|
@ -57,7 +57,7 @@ public class SplineHelper {
|
|||
return new Vector3f(x, y, z);
|
||||
}
|
||||
|
||||
public static void offsetParts(List<Vector3f> spline, RandomSource random, float dx, float dy, float dz) {
|
||||
public static void offsetParts(List<Vector3f> spline, Random random, float dx, float dy, float dz) {
|
||||
int count = spline.size();
|
||||
for (int i = 1; i < count; i++) {
|
||||
Vector3f pos = spline.get(i);
|
||||
|
|
|
@ -5,7 +5,6 @@ import net.minecraft.core.Vec3i;
|
|||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.nbt.NbtIo;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.WorldGenLevel;
|
||||
import net.minecraft.world.level.block.Mirror;
|
||||
import net.minecraft.world.level.block.Rotation;
|
||||
|
@ -18,6 +17,7 @@ import java.io.File;
|
|||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.Random;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipFile;
|
||||
|
||||
|
@ -88,7 +88,7 @@ public class StructureHelper {
|
|||
StructureTemplate structure,
|
||||
Rotation rotation,
|
||||
Mirror mirror,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
placeCenteredBottom(world, pos, structure, rotation, mirror, makeBox(pos), random);
|
||||
}
|
||||
|
@ -100,7 +100,7 @@ public class StructureHelper {
|
|||
Rotation rotation,
|
||||
Mirror mirror,
|
||||
BoundingBox bounds,
|
||||
RandomSource random
|
||||
Random random
|
||||
) {
|
||||
BlockPos offset = offsetPos(pos, structure, rotation, mirror);
|
||||
StructurePlaceSettings placementData = new StructurePlaceSettings().setRotation(rotation)
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
package org.betterx.bclib.util;
|
||||
|
||||
import net.minecraft.util.RandomSource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
@ -30,7 +28,7 @@ public class WeightedList<T> {
|
|||
* @param random - {@link Random}.
|
||||
* @return {@link T} value.
|
||||
*/
|
||||
public T get(RandomSource random) {
|
||||
public T get(Random random) {
|
||||
if (maxWeight < 1) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package org.betterx.worlds.together.levelgen;
|
||||
|
||||
import org.betterx.bclib.util.MHelper;
|
||||
import org.betterx.worlds.together.WorldsTogether;
|
||||
import org.betterx.worlds.together.biomesource.BiomeSourceWithConfig;
|
||||
import org.betterx.worlds.together.chunkgenerator.EnforceableChunkGenerator;
|
||||
|
@ -9,19 +10,18 @@ import org.betterx.worlds.together.worldPreset.TogetherWorldPreset;
|
|||
import org.betterx.worlds.together.worldPreset.WorldPresets;
|
||||
|
||||
import com.mojang.datafixers.util.Pair;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.util.RandomSource;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||
|
||||
|
@ -76,7 +76,7 @@ public class WorldGenUtil {
|
|||
}
|
||||
|
||||
public static WorldGenSettings createDefaultWorldFromPreset(RegistryAccess registryAccess) {
|
||||
return createDefaultWorldFromPreset(registryAccess, RandomSource.create().nextLong());
|
||||
return createDefaultWorldFromPreset(registryAccess, MHelper.RANDOM.nextLong());
|
||||
}
|
||||
|
||||
public static CompoundTag getPresetsNbt() {
|
||||
|
|
|
@ -8,12 +8,12 @@ import com.mojang.datafixers.util.Pair;
|
|||
import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.gui.screens.worldselection.CreateWorldScreen;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldGenSettingsComponent;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.WorldLoader;
|
||||
import net.minecraft.world.level.DataPackConfig;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
|
|
|
@ -3,8 +3,8 @@ package org.betterx.worlds.together.mixin.client;
|
|||
import org.betterx.worlds.together.worldPreset.WorldGenSettingsComponentAccessor;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldGenSettingsComponent;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
|
|
@ -2,12 +2,14 @@ package org.betterx.worlds.together.mixin.common;
|
|||
|
||||
import org.betterx.worlds.together.chunkgenerator.ChunkGeneratorUtils;
|
||||
|
||||
import com.mojang.authlib.GameProfileRepository;
|
||||
import com.mojang.authlib.minecraft.MinecraftSessionService;
|
||||
import com.mojang.datafixers.DataFixer;
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.Services;
|
||||
import net.minecraft.server.WorldStem;
|
||||
import net.minecraft.server.level.progress.ChunkProgressListenerFactory;
|
||||
import net.minecraft.server.packs.repository.PackRepository;
|
||||
import net.minecraft.server.players.GameProfileCache;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
@ -27,7 +29,9 @@ public class MinecraftServerMixinLate {
|
|||
WorldStem worldStem,
|
||||
Proxy proxy,
|
||||
DataFixer dataFixer,
|
||||
Services services,
|
||||
MinecraftSessionService minecraftSessionService,
|
||||
GameProfileRepository gameProfileRepository,
|
||||
GameProfileCache gameProfileCache,
|
||||
ChunkProgressListenerFactory chunkProgressListenerFactory,
|
||||
CallbackInfo ci
|
||||
) {
|
||||
|
|
|
@ -2,9 +2,9 @@ package org.betterx.worlds.together.mixin.common;
|
|||
|
||||
import org.betterx.worlds.together.worldPreset.WorldPresets;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.server.dedicated.DedicatedServerProperties;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.betterx.worlds.together.mixin.common;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.gen.Accessor;
|
||||
|
|
|
@ -5,10 +5,10 @@ import org.betterx.worlds.together.worldPreset.TogetherWorldPreset;
|
|||
import com.mojang.datafixers.kinds.App;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
|
|
|
@ -3,13 +3,13 @@ package org.betterx.worlds.together.mixin.common;
|
|||
import org.betterx.worlds.together.levelgen.WorldGenUtil;
|
||||
import org.betterx.worlds.together.worldPreset.WorldPresets;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
import net.minecraft.world.level.dimension.DimensionType;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.levelgen.structure.StructureSet;
|
||||
import net.minecraft.world.level.levelgen.synth.NormalNoise;
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import net.minecraft.world.level.biome.Biome;
|
|||
|
||||
public class CommonBiomeTags {
|
||||
public static final TagKey<Biome> IN_NETHER = TagManager.BIOMES.makeCommonTag("in_nether");
|
||||
public static final TagKey<Biome> IN_END = TagManager.BIOMES.makeCommonTag("in_end");
|
||||
|
||||
static void prepareTags() {
|
||||
}
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.betterx.worlds.together.world.event;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package org.betterx.worlds.together.world.event;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ import org.betterx.worlds.together.worldPreset.WorldGenSettingsComponentAccessor
|
|||
import org.betterx.worlds.together.worldPreset.WorldPresets;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldGenSettingsComponent;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
|
@ -22,7 +23,6 @@ import net.minecraft.resources.ResourceKey;
|
|||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.WorldGenSettings;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
import net.minecraft.world.level.storage.LevelResource;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.betterx.worlds.together.world.event.WorldBootstrap;
|
|||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.Dynamic;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -18,7 +19,6 @@ import net.minecraft.resources.RegistryOps;
|
|||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
@ -142,6 +142,11 @@ public class TogetherWorldPreset extends WorldPreset {
|
|||
return DimensionsWrapper.build(reg);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ChunkGenerator generator(RegistryAccess registryAccess, long l) {
|
||||
return null;
|
||||
}
|
||||
|
||||
private static class DimensionsWrapper {
|
||||
public static final Codec<DimensionsWrapper> CODEC = RecordCodecBuilder.create(instance -> instance
|
||||
.group(Codec.unboundedMap(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package org.betterx.worlds.together.worldPreset;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.betterx.worlds.together.tag.v3.TagManager;
|
|||
import org.betterx.worlds.together.tag.v3.TagRegistry;
|
||||
import org.betterx.worlds.together.worldPreset.client.WorldPresetsClient;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.RegistryAccess;
|
||||
|
@ -15,7 +16,6 @@ import net.minecraft.resources.ResourceKey;
|
|||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.WorldPresetTags;
|
||||
import net.minecraft.world.level.dimension.LevelStem;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
|
|
|
@ -2,9 +2,8 @@ package org.betterx.worlds.together.worldPreset.client;
|
|||
|
||||
import org.betterx.bclib.registry.PresetsRegistryClient;
|
||||
|
||||
import net.minecraft.client.gui.screens.worldselection.PresetEditor;
|
||||
import net.minecraft.client.gui.screens.worldselection.WorldPreset;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.world.level.levelgen.presets.WorldPreset;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
|
@ -13,7 +12,7 @@ import java.util.Optional;
|
|||
|
||||
@Environment(EnvType.CLIENT)
|
||||
public class WorldPresetsClient {
|
||||
public static void registerCustomizeUI(ResourceKey<WorldPreset> key, PresetEditor setupScreen) {
|
||||
public static void registerCustomizeUI(ResourceKey<WorldPreset> key, WorldPreset.PresetEditor setupScreen) {
|
||||
if (setupScreen != null) {
|
||||
PresetEditor.EDITORS.put(Optional.of(key), setupScreen);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue