Fixed Compile Errors

This commit is contained in:
Frank 2022-05-13 00:05:05 +02:00
parent 4ba3a71a68
commit 05eac6f539
79 changed files with 979 additions and 844 deletions

View file

@ -7,7 +7,7 @@ import net.minecraft.world.level.block.Block;
import ru.bclib.util.WeightedList;
import java.util.Map;
import java.util.Random;
import java.util.Random;import net.minecraft.util.RandomSource;
import java.util.Set;
public class BonemealAPI {
@ -111,7 +111,7 @@ public class BonemealAPI {
list.add(plant, chance);
}
public static Block getLandGrass(ResourceLocation biomeID, Block terrain, Random random) {
public static Block getLandGrass(ResourceLocation biomeID, Block terrain, RandomSource random) {
Map<Block, WeightedList<Block>> map = LAND_GRASS_BIOMES.get(biomeID);
WeightedList<Block> list = null;
if (map != null) {
@ -126,7 +126,7 @@ public class BonemealAPI {
return list == null ? null : list.get(random);
}
public static Block getWaterGrass(ResourceLocation biomeID, Block terrain, Random random) {
public static Block getWaterGrass(ResourceLocation biomeID, Block terrain, RandomSource random) {
Map<Block, WeightedList<Block>> map = WATER_GRASS_BIOMES.get(biomeID);
WeightedList<Block> list = null;
if (map != null) {

View file

@ -50,9 +50,7 @@ public class LifeCycleAPI {
LevelStorageSource.LevelStorageAccess levelStorageAccess,
ServerLevelData serverLevelData,
ResourceKey<Level> resourceKey,
Holder<DimensionType> dimensionType,
ChunkProgressListener chunkProgressListener,
ChunkGenerator chunkGenerator,
boolean bl,
long l,
List<CustomSpawner> list,
@ -101,9 +99,7 @@ public class LifeCycleAPI {
* @param levelStorageAccess
* @param serverLevelData
* @param resourceKey
* @param dimensionType
* @param chunkProgressListener
* @param chunkGenerator
* @param bl
* @param l
* @param list
@ -115,9 +111,7 @@ public class LifeCycleAPI {
LevelStorageSource.LevelStorageAccess levelStorageAccess,
ServerLevelData serverLevelData,
ResourceKey<Level> resourceKey,
Holder<DimensionType> dimensionType,
ChunkProgressListener chunkProgressListener,
ChunkGenerator chunkGenerator,
boolean bl,
long l,
List<CustomSpawner> list,
@ -129,9 +123,7 @@ public class LifeCycleAPI {
levelStorageAccess,
serverLevelData,
resourceKey,
dimensionType,
chunkProgressListener,
chunkGenerator,
bl,
l,
list,

View file

@ -19,7 +19,6 @@ import net.minecraft.world.level.biome.AmbientMoodSettings;
import net.minecraft.world.level.biome.AmbientParticleSettings;
import net.minecraft.world.level.biome.Biome;
import net.minecraft.world.level.biome.Biome.BiomeBuilder;
import net.minecraft.world.level.biome.Biome.BiomeCategory;
import net.minecraft.world.level.biome.Biome.Precipitation;
import net.minecraft.world.level.biome.BiomeGenerationSettings;
import net.minecraft.world.level.biome.BiomeSpecialEffects;
@ -43,7 +42,7 @@ import ru.bclib.util.TriFunction;
import ru.bclib.world.biomes.BCLBiome;
import ru.bclib.world.biomes.BCLBiomeSettings;
import ru.bclib.world.features.BCLFeature;
import ru.bclib.world.structures.BCLStructureFeature;
import ru.bclib.world.structures.BCLStructure;
import java.util.ArrayList;
import java.util.List;
@ -67,7 +66,8 @@ public class BCLBiomeBuilder {
private SurfaceRules.RuleSource surfaceRule;
private Precipitation precipitation;
private ResourceLocation biomeID;
private BiomeCategory category;
//BiomeTags.IS_NETHER
private float temperature;
private float fogDensity;
private float genChance;
@ -86,7 +86,6 @@ public class BCLBiomeBuilder {
public static BCLBiomeBuilder start(ResourceLocation biomeID) {
INSTANCE.biomeID = biomeID;
INSTANCE.precipitation = Precipitation.NONE;
INSTANCE.category = BiomeCategory.NONE;
INSTANCE.generationSettings = null;
INSTANCE.effectsBuilder = null;
INSTANCE.spawnSettings = null;
@ -113,16 +112,6 @@ public class BCLBiomeBuilder {
return this;
}
/**
* Set biome category. Doesn't affect biome worldgen, but Fabric biome modifications can target biome by it.
* @param category {@link BiomeCategory}
* @return same {@link BCLBiomeBuilder} instance.
*/
public BCLBiomeBuilder category(BiomeCategory category) {
this.category = category;
return this;
}
/**
* Set biome temperature, affect plant color, biome generation and ice formation.
* @param temperature biome temperature.
@ -556,10 +545,10 @@ public class BCLBiomeBuilder {
/**
* Adds new structure feature into thr biome. Will add building biome into the structure list.
* @param structure {@link BCLStructureFeature} to add.
* @param structure {@link BCLStructure} to add.
* @return same {@link BCLBiomeBuilder} instance.
*/
public BCLBiomeBuilder structure(BCLStructureFeature structure) {
public BCLBiomeBuilder structure(BCLStructure structure) {
structure.addInternalBiome(biomeID);
return structure(structure.biomeTag);
}
@ -685,7 +674,6 @@ public class BCLBiomeBuilder {
public <T extends BCLBiome> T build(BiomeSupplier<T> biomeConstructor) {
BiomeBuilder builder = new BiomeBuilder()
.precipitation(precipitation)
.biomeCategory(category)
.temperature(temperature)
.downfall(downfall);

View file

@ -44,7 +44,6 @@ import net.minecraft.world.level.levelgen.SurfaceRules;
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
import net.minecraft.world.level.levelgen.carver.ConfiguredWorldCarver;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import org.apache.commons.lang3.mutable.MutableInt;
@ -72,7 +71,9 @@ import java.util.Map;
import java.util.Map.Entry;
import java.util.Objects;
import java.util.Optional;
import java.util.Random;
import java.util.Random;import net.minecraft.util.RandomSource;
import net.minecraft.world.level.levelgen.structure.Structure;
import java.util.Set;
import java.util.function.BiConsumer;
import java.util.function.Supplier;
@ -836,9 +837,9 @@ public class BiomeAPI {
static class StructureID {
public final ResourceLocation biomeID;
public final ConfiguredStructureFeature structure;
public final Holder<Structure> structure;
StructureID(ResourceLocation biomeID, ConfiguredStructureFeature structure){
StructureID(ResourceLocation biomeID, Holder<Structure> structure){
this.biomeID = biomeID;
this.structure = structure;
}

View file

@ -8,6 +8,7 @@ import net.minecraft.client.Minecraft;
import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.network.chat.CommonComponents;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.ResourceLocation;
import ru.bclib.BCLib;
import ru.bclib.api.dataexchange.DataExchangeAPI;

View file

@ -156,10 +156,21 @@ public class DataFixerAPI {
*/
public static void initializeWorldData(LevelStorageSource levelSource, String levelID, boolean newWorld) {
wrapCall(levelSource, levelID, (levelStorageAccess) -> {
initializeWorldData(levelStorageAccess.getLevelPath(LevelResource.ROOT).toFile(), newWorld);
initializeWorldData(levelStorageAccess, newWorld);
return true;
});
}
/**
* Initializes the DataStorage for this world. If the world is new, the patch registry is initialized to the
* current versions of the plugins.
* @param access levelAccess for the worldd
* @param newWorld {@code true} if this is a fresh world
*
*/
public static void initializeWorldData(LevelStorageAccess access, boolean newWorld){
initializeWorldData(access.getLevelPath(LevelResource.ROOT).toFile(), newWorld);
}
/**
* Initializes the DataStorage for this world. If the world is new, the patch registry is initialized to the

View file

@ -8,7 +8,7 @@ import net.minecraft.world.level.LevelAccessor;
import org.jetbrains.annotations.NotNull;
import ru.bclib.interfaces.SpawnRule;
import java.util.Random;
import java.util.Random;import net.minecraft.util.RandomSource;
public class SpawnRuleEntry<M extends Mob> implements Comparable<SpawnRuleEntry> {
private final SpawnRule rule;
@ -19,7 +19,7 @@ public class SpawnRuleEntry<M extends Mob> implements Comparable<SpawnRuleEntry>
this.rule = rule;
}
protected boolean canSpawn(EntityType<M> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, Random random) {
protected boolean canSpawn(EntityType<M> type, LevelAccessor world, MobSpawnType spawnReason, BlockPos pos, RandomSource random) {
return rule.canSpawn(type, world, spawnReason, pos, random);
}

View file

@ -3,6 +3,7 @@ package ru.bclib.api.surface.rules;
import com.mojang.serialization.Codec;
import com.mojang.serialization.codecs.RecordCodecBuilder;
import net.minecraft.core.Registry;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.levelgen.SurfaceRules.Context;
import net.minecraft.world.level.levelgen.SurfaceRules.RuleSource;
@ -20,9 +21,11 @@ public record SwitchRuleSource(NumericProvider selector, List<RuleSource> collec
RuleSource.CODEC.listOf().fieldOf("collection").forGetter(SwitchRuleSource::collection)
).apply(instance, SwitchRuleSource::new));
private static final KeyDispatchDataCodec<? extends RuleSource> KEY_CODEC = KeyDispatchDataCodec.of(SwitchRuleSource.CODEC);
@Override
public Codec<? extends RuleSource> codec() {
return SwitchRuleSource.CODEC;
public KeyDispatchDataCodec<? extends RuleSource> codec() {
return KEY_CODEC;
}
@Override

View file

@ -1,6 +1,6 @@
package ru.bclib.api.surface.rules;
import com.mojang.serialization.Codec;
import net.minecraft.util.KeyDispatchDataCodec;
import net.minecraft.world.level.levelgen.SurfaceRules.Condition;
import net.minecraft.world.level.levelgen.SurfaceRules.ConditionSource;
import net.minecraft.world.level.levelgen.SurfaceRules.Context;
@ -8,7 +8,7 @@ import net.minecraft.world.level.levelgen.SurfaceRules.LazyCondition;
import ru.bclib.mixin.common.SurfaceRulesContextAccessor;
public abstract class VolumeNoiseCondition implements NoiseCondition{
public abstract Codec<? extends ConditionSource> codec();
public abstract KeyDispatchDataCodec<? extends ConditionSource> codec();
@Override
public final Condition apply(Context context2) {