Fixes for 1.19-pre1
This commit is contained in:
parent
d533f93113
commit
c6742982df
13 changed files with 165 additions and 174 deletions
|
@ -22,18 +22,14 @@ import net.minecraft.world.level.biome.BiomeGenerationSettings;
|
|||
import net.minecraft.world.level.biome.BiomeSource;
|
||||
import net.minecraft.world.level.biome.Biomes;
|
||||
import net.minecraft.world.level.biome.MobSpawnSettings.SpawnerData;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.chunk.ChunkAccess;
|
||||
import net.minecraft.world.level.chunk.ChunkGenerator;
|
||||
import net.minecraft.world.level.chunk.PalettedContainer;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Carving;
|
||||
import net.minecraft.world.level.levelgen.GenerationStep.Decoration;
|
||||
import net.minecraft.world.level.levelgen.NoiseBasedChunkGenerator;
|
||||
import net.minecraft.world.level.levelgen.NoiseGeneratorSettings;
|
||||
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.Feature;
|
||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||
|
@ -53,8 +49,10 @@ import org.apache.commons.lang3.mutable.MutableInt;
|
|||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.api.tag.CommonBiomeTags;
|
||||
import org.betterx.bclib.api.tag.TagAPI;
|
||||
import org.betterx.bclib.entity.BCLEntityWrapper;
|
||||
import org.betterx.bclib.interfaces.*;
|
||||
import org.betterx.bclib.interfaces.BiomeSourceAccessor;
|
||||
import org.betterx.bclib.interfaces.NoiseGeneratorSettingsProvider;
|
||||
import org.betterx.bclib.interfaces.SurfaceMaterialProvider;
|
||||
import org.betterx.bclib.interfaces.SurfaceRuleProvider;
|
||||
import org.betterx.bclib.mixin.client.MinecraftMixin;
|
||||
import org.betterx.bclib.mixin.common.BiomeGenerationSettingsAccessor;
|
||||
import org.betterx.bclib.mixin.common.MobSpawnSettingsAccessor;
|
||||
|
@ -483,7 +481,7 @@ public class BiomeAPI {
|
|||
|
||||
FabricBiomesData.END_VOID_BIOMES.forEach((key, weight) -> {
|
||||
if (!hasBiome(key.location())) {
|
||||
registerEndVoidBiome(BuiltinRegistries.BIOME.getOrCreateHolder(key), weight);
|
||||
registerEndVoidBiome(BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(key), weight);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -495,7 +493,7 @@ public class BiomeAPI {
|
|||
|
||||
@Nullable
|
||||
public static Holder<Biome> getFromRegistry(ResourceKey<Biome> key) {
|
||||
return BuiltinRegistries.BIOME.getOrCreateHolder(key);
|
||||
return BuiltinRegistries.BIOME.getOrCreateHolderOrThrow(key);
|
||||
}
|
||||
|
||||
public static boolean isDatapackBiome(ResourceLocation biomeID) {
|
||||
|
@ -858,6 +856,7 @@ public class BiomeAPI {
|
|||
public static Optional<BlockState> findUnderMaterial(Holder<Biome> biome) {
|
||||
return findUnderMaterial(getBiome(biome.value()));
|
||||
}
|
||||
|
||||
public static Optional<BlockState> findUnderMaterial(BCLBiome biome) {
|
||||
if (biome instanceof SurfaceMaterialProvider smp) {
|
||||
return Optional.of(smp.getUnderMaterial());
|
||||
|
|
|
@ -5,8 +5,9 @@ import net.minecraft.core.Registry;
|
|||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.server.packs.resources.ResourceManager;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagEntry;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.tags.TagLoader;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.Items;
|
||||
|
@ -16,9 +17,11 @@ import net.minecraft.world.level.block.Block;
|
|||
import net.minecraft.world.level.block.Blocks;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.api.biomes.BiomeAPI;
|
||||
import org.betterx.bclib.mixin.common.DiggerItemAccessor;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
|
@ -229,8 +232,8 @@ public class TagAPI {
|
|||
* @param tagsMap The map that will hold the registered Tags
|
||||
* @return The {@code tagsMap} Parameter.
|
||||
*/
|
||||
public static <T> Map<ResourceLocation, Tag.Builder> apply(String directory,
|
||||
Map<ResourceLocation, Tag.Builder> tagsMap) {
|
||||
public static <T> Map<ResourceLocation, List<TagLoader.EntryWithSource>> apply(String directory,
|
||||
Map<ResourceLocation, List<TagLoader.EntryWithSource>> tagsMap) {
|
||||
|
||||
TagType<?> type = TYPES.get(directory);
|
||||
if (type != null) {
|
||||
|
@ -259,8 +262,9 @@ public class TagAPI {
|
|||
* @param ids
|
||||
* @return The Builder passed as {@code builder}.
|
||||
*/
|
||||
public static Tag.Builder apply(Tag.Builder builder, Set<ResourceLocation> ids) {
|
||||
ids.forEach(value -> builder.addElement(value, "BCLib Code"));
|
||||
public static List<TagLoader.EntryWithSource> apply(List<TagLoader.EntryWithSource> builder,
|
||||
Set<ResourceLocation> ids) {
|
||||
ids.forEach(value -> builder.add(new TagLoader.EntryWithSource(TagEntry.element(value), BCLib.MOD_ID)));
|
||||
return builder;
|
||||
}
|
||||
|
||||
|
|
|
@ -4,16 +4,18 @@ import net.minecraft.core.DefaultedRegistry;
|
|||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.ResourceLocation;
|
||||
import net.minecraft.tags.Tag;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.tags.TagLoader;
|
||||
import net.minecraft.tags.TagManager;
|
||||
import net.minecraft.world.level.biome.Biome;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import com.google.common.collect.Sets;
|
||||
import org.betterx.bclib.BCLib;
|
||||
import org.betterx.bclib.api.biomes.BiomeAPI;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.BiConsumer;
|
||||
|
@ -190,10 +192,10 @@ public class TagType<T> {
|
|||
tags.forEach(consumer);
|
||||
}
|
||||
|
||||
public void apply(Map<ResourceLocation, Tag.Builder> tagsMap) {
|
||||
public void apply(Map<ResourceLocation, List<TagLoader.EntryWithSource>> tagsMap) {
|
||||
if (Registry.BIOME_REGISTRY.equals(registryKey)) BiomeAPI._runTagAdders();
|
||||
|
||||
//this.isFrozen = true;
|
||||
this.forEach((id, ids) -> TagAPI.apply(tagsMap.computeIfAbsent(id, key -> Tag.Builder.tag()), ids));
|
||||
this.forEach((id, ids) -> TagAPI.apply(tagsMap.computeIfAbsent(id, key -> Lists.newArrayList()), ids));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue