-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Switch Luminous Grove surface generation to a surface builder.
- Fix Luminous Grove surface generation when TerraBlender is present
- Loading branch information
1 parent
ed3a487
commit e781033
Showing
9 changed files
with
56 additions
and
89 deletions.
There are no files selected for viewing
13 changes: 0 additions & 13 deletions
13
...n/src/main/java/com/terraformersmc/cinderscapes/mixin/ChunkGeneratorSettingsAccessor.java
This file was deleted.
Oops, something went wrong.
12 changes: 0 additions & 12 deletions
12
...dgen/src/main/java/com/terraformersmc/cinderscapes/mixin/MaterialRuleContextAccessor.java
This file was deleted.
Oops, something went wrong.
43 changes: 0 additions & 43 deletions
43
worldgen/src/main/java/com/terraformersmc/cinderscapes/mixin/MixinMinecraftServer.java
This file was deleted.
Oops, something went wrong.
13 changes: 0 additions & 13 deletions
13
...dgen/src/main/java/com/terraformersmc/cinderscapes/mixin/NoiseChunkGeneratorAccessor.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
...ain/java/com/terraformersmc/cinderscapes/surfacebuilders/LuminousGroveSurfaceBuilder.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package com.terraformersmc.cinderscapes.surfacebuilders; | ||
|
||
import net.minecraft.block.BlockState; | ||
import net.minecraft.tag.BiomeTags; | ||
import net.minecraft.util.math.BlockPos; | ||
import net.minecraft.util.registry.RegistryEntry; | ||
import net.minecraft.world.biome.Biome; | ||
import net.minecraft.world.biome.source.BiomeAccess; | ||
import net.minecraft.world.chunk.Chunk; | ||
import net.minecraft.world.gen.chunk.BlockColumn; | ||
import net.minecraft.world.gen.random.AbstractRandom; | ||
|
||
public class LuminousGroveSurfaceBuilder extends CinderscapesSurfaceBuilder { | ||
private final BlockState topMaterial; | ||
private final BlockState midMaterial; | ||
private final BlockState lowMaterial; | ||
|
||
public LuminousGroveSurfaceBuilder(BlockState topMaterial, BlockState midMaterial, BlockState lowMaterial) { | ||
this.topMaterial = topMaterial; | ||
this.midMaterial = midMaterial; | ||
this.lowMaterial = lowMaterial; | ||
} | ||
|
||
@Override | ||
public void generate(BiomeAccess biomeAccess, BlockColumn column, AbstractRandom rand, Chunk chunk, Biome biome, int x, int z, int vHeight, int seaLevel) { | ||
BlockPos pos = new BlockPos(x, -128, z); | ||
boolean inAir = false; | ||
|
||
// Set in-biome netherrack | ||
for (int y = chunk.getTopY() - 6; y >= seaLevel - 1; --y) { | ||
BlockState state = column.getState(y); | ||
if (state.isAir()) { | ||
inAir = true; | ||
} else { | ||
if (inAir && state.isOf(lowMaterial.getBlock()) && biomeAccess.getBiome(pos.withY(y)).matchesKey(biomeKey)) { | ||
column.setState(y, rand.nextFloat() < 0.99f ? topMaterial : midMaterial); | ||
} | ||
inAir = false; | ||
} | ||
} | ||
} | ||
|
||
@Override | ||
public boolean filterBiome(RegistryEntry<Biome> biome) { | ||
return biome.isIn(BiomeTags.IS_NETHER); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters