Added some helpers for surface blocks
This commit is contained in:
parent
46af6f07e2
commit
e72d1bcff2
2 changed files with 31 additions and 12 deletions
|
@ -1,5 +1,18 @@
|
||||||
package ru.bclib.api.biomes;
|
package ru.bclib.api.biomes;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Random;
|
||||||
|
import java.util.Set;
|
||||||
|
import java.util.function.BiConsumer;
|
||||||
|
import java.util.function.Consumer;
|
||||||
|
import java.util.function.Supplier;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
import com.google.common.collect.HashMultimap;
|
import com.google.common.collect.HashMultimap;
|
||||||
import com.google.common.collect.ImmutableMap;
|
import com.google.common.collect.ImmutableMap;
|
||||||
import com.google.common.collect.ImmutableMultimap;
|
import com.google.common.collect.ImmutableMultimap;
|
||||||
|
@ -7,6 +20,7 @@ import com.google.common.collect.Lists;
|
||||||
import com.google.common.collect.Maps;
|
import com.google.common.collect.Maps;
|
||||||
import com.google.common.collect.Multimap;
|
import com.google.common.collect.Multimap;
|
||||||
import com.google.common.collect.Sets;
|
import com.google.common.collect.Sets;
|
||||||
|
|
||||||
import net.fabricmc.api.EnvType;
|
import net.fabricmc.api.EnvType;
|
||||||
import net.fabricmc.api.Environment;
|
import net.fabricmc.api.Environment;
|
||||||
import net.fabricmc.fabric.impl.biome.NetherBiomeData;
|
import net.fabricmc.fabric.impl.biome.NetherBiomeData;
|
||||||
|
@ -43,7 +57,6 @@ import net.minecraft.world.level.levelgen.feature.ConfiguredStructureFeature;
|
||||||
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
import net.minecraft.world.level.levelgen.feature.StructureFeature;
|
||||||
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
|
||||||
import org.apache.commons.lang3.mutable.MutableInt;
|
import org.apache.commons.lang3.mutable.MutableInt;
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import ru.bclib.BCLib;
|
import ru.bclib.BCLib;
|
||||||
import ru.bclib.config.Configs;
|
import ru.bclib.config.Configs;
|
||||||
import ru.bclib.interfaces.SurfaceProvider;
|
import ru.bclib.interfaces.SurfaceProvider;
|
||||||
|
@ -59,17 +72,6 @@ import ru.bclib.world.features.BCLFeature;
|
||||||
import ru.bclib.world.generator.BiomePicker;
|
import ru.bclib.world.generator.BiomePicker;
|
||||||
import ru.bclib.world.structures.BCLStructureFeature;
|
import ru.bclib.world.structures.BCLStructureFeature;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
import java.util.Set;
|
|
||||||
import java.util.function.BiConsumer;
|
|
||||||
import java.util.function.Consumer;
|
|
||||||
import java.util.function.Supplier;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
public class BiomeAPI {
|
public class BiomeAPI {
|
||||||
/**
|
/**
|
||||||
* Empty biome used as default value if requested biome doesn't exist or linked. Shouldn't be registered anywhere to prevent bugs.
|
* Empty biome used as default value if requested biome doesn't exist or linked. Shouldn't be registered anywhere to prevent bugs.
|
||||||
|
@ -353,6 +355,15 @@ public class BiomeAPI {
|
||||||
public static BCLBiome getBiome(ResourceLocation biomeID) {
|
public static BCLBiome getBiome(ResourceLocation biomeID) {
|
||||||
return ID_MAP.getOrDefault(biomeID, EMPTY_BIOME);
|
return ID_MAP.getOrDefault(biomeID, EMPTY_BIOME);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get {@link BCLBiome} from given {@link Biome}.
|
||||||
|
* @param biome - biome {@link Biome}.
|
||||||
|
* @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}.
|
||||||
|
*/
|
||||||
|
public static BCLBiome getBiome(Biome biome) {
|
||||||
|
return getBiome(BiomeAPI.getBiomeID(biome));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check if biome with {@link ResourceLocation} exists in API registry.
|
* Check if biome with {@link ResourceLocation} exists in API registry.
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
package ru.bclib.api.biomes;
|
||||||
|
|
||||||
|
import net.minecraft.world.level.block.state.BlockState;
|
||||||
|
|
||||||
|
public interface SurfaceMaterialProvider {
|
||||||
|
BlockState getTopMaterial();
|
||||||
|
BlockState getAltTopMaterial();
|
||||||
|
}
|
Loading…
Add table
Add a link
Reference in a new issue