Fixed structure features and code style
This commit is contained in:
parent
d431f2555c
commit
5a9365e2bb
153 changed files with 2304 additions and 2459 deletions
|
@ -1,10 +1,6 @@
|
|||
package ru.bclib.api;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
import com.google.common.collect.Maps;
|
||||
|
||||
import net.fabricmc.api.EnvType;
|
||||
import net.fabricmc.api.Environment;
|
||||
import net.fabricmc.fabric.impl.biome.InternalBiomeData;
|
||||
|
@ -20,6 +16,9 @@ import net.minecraft.world.level.biome.Biomes;
|
|||
import ru.bclib.util.MHelper;
|
||||
import ru.bclib.world.biomes.BCLBiome;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Random;
|
||||
|
||||
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.
|
||||
|
@ -33,6 +32,7 @@ public class BiomeAPI {
|
|||
|
||||
/**
|
||||
* Initialize registry for current server.
|
||||
*
|
||||
* @param server - {@link MinecraftServer}
|
||||
*/
|
||||
public static void initRegistry(MinecraftServer server) {
|
||||
|
@ -49,23 +49,19 @@ public class BiomeAPI {
|
|||
|
||||
/**
|
||||
* Adds {@link BCLBiome} to FabricAPI biomes as the Nether biome (with random {@link ClimateParameters}).
|
||||
*
|
||||
* @param biome - {@link BCLBiome}.
|
||||
*/
|
||||
public static void addNetherBiomeToFabricApi(BCLBiome biome) {
|
||||
ResourceKey<Biome> key = BuiltinRegistries.BIOME.getResourceKey(biome.getBiome()).get();
|
||||
Random random = new Random(biome.getID().toString().hashCode());
|
||||
ClimateParameters parameters = new ClimateParameters(
|
||||
MHelper.randRange(-2F, 2F, random),
|
||||
MHelper.randRange(-2F, 2F, random),
|
||||
MHelper.randRange(-2F, 2F, random),
|
||||
MHelper.randRange(-2F, 2F, random),
|
||||
MHelper.randRange(-2F, 2F, random)
|
||||
);
|
||||
ClimateParameters parameters = new ClimateParameters(MHelper.randRange(-2F, 2F, random), MHelper.randRange(-2F, 2F, random), MHelper.randRange(-2F, 2F, random), MHelper.randRange(-2F, 2F, random), MHelper.randRange(-2F, 2F, random));
|
||||
InternalBiomeData.addNetherBiome(key, parameters);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds {@link BCLBiome} to FabricAPI biomes as an End land biome (generating on islands).
|
||||
*
|
||||
* @param biome - {@link BCLBiome}.
|
||||
*/
|
||||
public static void addEndLandBiomeToFabricApi(BCLBiome biome) {
|
||||
|
@ -77,6 +73,7 @@ public class BiomeAPI {
|
|||
|
||||
/**
|
||||
* Adds {@link BCLBiome} to FabricAPI biomes as an End void biome (generating between islands in the void).
|
||||
*
|
||||
* @param biome - {@link BCLBiome}.
|
||||
*/
|
||||
public static void addEndVoidBiomeToFabricApi(BCLBiome biome) {
|
||||
|
@ -87,6 +84,7 @@ public class BiomeAPI {
|
|||
|
||||
/**
|
||||
* Get {@link BCLBiome} from {@link Biome} instance on server. Used to convert world biomes to BCLBiomes.
|
||||
*
|
||||
* @param biome - {@link Biome} from world.
|
||||
* @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}.
|
||||
*/
|
||||
|
@ -99,6 +97,7 @@ public class BiomeAPI {
|
|||
|
||||
/**
|
||||
* Get {@link BCLBiome} from biome on client. Used in fog rendering.
|
||||
*
|
||||
* @param biome - {@link Biome} from client world.
|
||||
* @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}.
|
||||
*/
|
||||
|
@ -116,6 +115,7 @@ public class BiomeAPI {
|
|||
|
||||
/**
|
||||
* Get biome {@link ResourceLocation} from given {@link Biome}.
|
||||
*
|
||||
* @param biome - {@link Biome} from server world.
|
||||
* @return biome {@link ResourceLocation}.
|
||||
*/
|
||||
|
@ -123,9 +123,10 @@ public class BiomeAPI {
|
|||
ResourceLocation id = biomeRegistry.getKey(biome);
|
||||
return id == null ? EMPTY_BIOME.getID() : id;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Get {@link BCLBiome} from given {@link ResourceLocation}.
|
||||
*
|
||||
* @param biomeID - biome {@link ResourceLocation}.
|
||||
* @return {@link BCLBiome} or {@code BiomeAPI.EMPTY_BIOME}.
|
||||
*/
|
||||
|
@ -135,6 +136,7 @@ public class BiomeAPI {
|
|||
|
||||
/**
|
||||
* Get actual {@link Biome} from given {@link BCLBiome}. If it is null it will request it from current {@link Registry}.
|
||||
*
|
||||
* @param biome - {@link BCLBiome}.
|
||||
* @return {@link Biome}.
|
||||
*/
|
||||
|
@ -149,6 +151,7 @@ public class BiomeAPI {
|
|||
|
||||
/**
|
||||
* Check if biome with {@link ResourceLocation} exists in API registry.
|
||||
*
|
||||
* @param biomeID - biome {@link ResourceLocation}.
|
||||
* @return {@code true} if biome exists in API registry and {@code false} if not.
|
||||
*/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue