mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
Fix data pack biomes failing to load in SingleBiomeProvider (#7434)
This commit is contained in:
1 parent
6982c5dd56
commit
8a77681574
4 files changed
+53
-7
No files matched your search
@@ -875,13 +875,13 @@ public class ForgeHooks
|
||||
Biome apply(final Biome.Climate climate, final Biome.Category category, final Float depth, final Float scale, final BiomeAmbience effects, final BiomeGenerationSettings gen, final MobSpawnInfo spawns);
|
||||
}
|
||||
|
||||
public static Biome enhanceBiome(final ResourceLocation name, final Biome.Climate climate, final Biome.Category category, final Float depth, final Float scale, final BiomeAmbience effects, final BiomeGenerationSettings gen, final MobSpawnInfo spawns, final RecordCodecBuilder.Instance<Biome> codec, final BiomeCallbackFunction callback)
|
||||
public static Biome enhanceBiome(@Nullable final ResourceLocation name, final Biome.Climate climate, final Biome.Category category, final Float depth, final Float scale, final BiomeAmbience effects, final BiomeGenerationSettings gen, final MobSpawnInfo spawns, final RecordCodecBuilder.Instance<Biome> codec, final BiomeCallbackFunction callback)
|
||||
{
|
||||
BiomeGenerationSettingsBuilder genBuilder = new BiomeGenerationSettingsBuilder(gen);
|
||||
MobSpawnInfoBuilder spawnBuilder = new MobSpawnInfoBuilder(spawns);
|
||||
BiomeLoadingEvent event = new BiomeLoadingEvent(name, climate, category, depth, scale, effects, genBuilder, spawnBuilder);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
return callback.apply(event.getClimate(), event.getCategory(), event.getDepth(), event.getScale(), event.getEffects(), event.getGeneration().func_242508_a(), event.getSpawns().func_242577_b());
|
||||
return callback.apply(event.getClimate(), event.getCategory(), event.getDepth(), event.getScale(), event.getEffects(), event.getGeneration().func_242508_a(), event.getSpawns().func_242577_b()).setRegistryName(name);
|
||||
}
|
||||
|
||||
private static class LootTableContext
|
||||
|
||||
@@ -27,6 +27,8 @@ import net.minecraftforge.common.world.MobSpawnInfoBuilder;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.eventbus.api.EventPriority;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* This event fires when a Biome is created from json or when a registered biome is re-created for worldgen.
|
||||
* It allows mods to edit a biome (like add a mob spawn) before it gets used for worldgen.
|
||||
@@ -52,7 +54,7 @@ public class BiomeLoadingEvent extends Event
|
||||
private final BiomeGenerationSettingsBuilder gen;
|
||||
private final MobSpawnInfoBuilder spawns;
|
||||
|
||||
public BiomeLoadingEvent(final ResourceLocation name, final Biome.Climate climate, final Biome.Category category, final float depth, final float scale, final BiomeAmbience effects, final BiomeGenerationSettingsBuilder gen, final MobSpawnInfoBuilder spawns)
|
||||
public BiomeLoadingEvent(@Nullable final ResourceLocation name, final Biome.Climate climate, final Biome.Category category, final float depth, final float scale, final BiomeAmbience effects, final BiomeGenerationSettingsBuilder gen, final MobSpawnInfoBuilder spawns)
|
||||
{
|
||||
this.name = name;
|
||||
this.climate = climate;
|
||||
@@ -64,6 +66,12 @@ public class BiomeLoadingEvent extends Event
|
||||
this.spawns = spawns;
|
||||
}
|
||||
|
||||
/**
|
||||
* This will get the registry name of the biome.
|
||||
* It generally SHOULD NOT be null, but due to vanilla's biome handling and codec weirdness, there may be cases where it is.
|
||||
* Do check for this possibility!
|
||||
*/
|
||||
@Nullable
|
||||
public ResourceLocation getName()
|
||||
{
|
||||
return name;
|
||||
|
||||
Reference in new issue
Block a user