Skip to content

Commit

Permalink
Trying to fix a rare crash in the End generation.
Browse files Browse the repository at this point in the history
- Trying to fix a rare crash in the End generation
- Pre-populate the End biome cache during init
  • Loading branch information
gniftygnome committed Jun 28, 2024
1 parent 9f09191 commit 03995e5
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,22 @@ public EndBiomePlacement() {
protected void serverReplaced(BiolithState state, long seed) {
super.serverReplaced(state, seed);

// Update vanilla biome entries for the End
RegistryEntryLookup<Biome> biomeEntryGetter = BiomeCoordinator.getBiomeLookupOrThrow();
nodeSmallEndIslands = new MultiNoiseUtil.SearchTree.TreeLeafNode<>(noiseSmallEndIslands, biomeEntryGetter.getOrThrow(BiomeKeys.SMALL_END_ISLANDS));
nodeEndBarrens = new MultiNoiseUtil.SearchTree.TreeLeafNode<>(noiseEndBarrens, biomeEntryGetter.getOrThrow(BiomeKeys.END_BARRENS));
nodeEndMidlands = new MultiNoiseUtil.SearchTree.TreeLeafNode<>(noiseEndMidlands, biomeEntryGetter.getOrThrow(BiomeKeys.END_MIDLANDS));
nodeEndHighlands = new MultiNoiseUtil.SearchTree.TreeLeafNode<>(noiseEndHighlands, biomeEntryGetter.getOrThrow(BiomeKeys.END_HIGHLANDS));

// Seed the End simplex noises based on the game seed
humidityNoise = new OpenSimplexNoise2(seedlets[7]);
temperatureNoise = new OpenSimplexNoise2(seedlets[5]);
weirdnessNoise = new OpenSimplexNoise2(seedlets[3]);

// Somehow, biolith$getBiome() can be called before biolith$biomeStream() in the End
if (state.getWorld().getChunkManager().getChunkGenerator().getBiomeSource().getBiomes() == null) {
throw new IllegalStateException("Biome entries for the End are null after initialization...");
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,8 @@ public void addBiomeReplacements(RegistryKey<Biome> target, Stream<RegistryKey<B

this.markDirty();
}

public ServerWorld getWorld() {
return world;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import java.util.Objects;
import java.util.stream.Stream;

@Mixin(TheEndBiomeSource.class)
@Mixin(value = TheEndBiomeSource.class, priority = 1100)
public abstract class MixinTheEndBiomeSource extends BiomeSource {
private static RegistryEntryLookup<Biome> biolith$biomeLookup;
private static MultiNoiseUtil.Entries<RegistryEntry<Biome>> biolith$biomeEntries;
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ enabled_platforms=fabric,neoforge

# Common
minecraft_version=1.21
yarn_mappings=1.21+build.1
yarn_mappings=1.21+build.4

# Fabric
fabric_api_version=0.100.1+1.21
fabric_api_version=0.100.4+1.21
fabric_loader_version=0.15.11

# Forge
Expand All @@ -31,10 +31,10 @@ neoforge_version=21.0.1-beta
mixinextras_version=0.3.6

# TerraBlender so we can use its API to access its region data
terrablender_version=1.21-4.0.0.0
terrablender_version=1.21-4.0.0.1

# Terraform API for simplex noise implementation
terraform_surfaces_api_version=10.0.0
terraform_surfaces_api_version=11.0.0-alpha.1

##
## Ferry configuration
Expand Down

0 comments on commit 03995e5

Please sign in to comment.