-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow Biolith to generate biomes in datapack worlds.
This is a large change; why we're still alpha I guess. - Biolith can now generate biomes in datapack worlds
- Loading branch information
1 parent
76dd6a9
commit a190f3b
Showing
16 changed files
with
255 additions
and
101 deletions.
There are no files selected for viewing
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
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
11 changes: 11 additions & 0 deletions
11
src/main/java/com/terraformersmc/biolith/impl/biome/InterfaceBiomeSource.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,11 @@ | ||
package com.terraformersmc.biolith.impl.biome; | ||
|
||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.world.dimension.DimensionType; | ||
|
||
@SuppressWarnings("unused") | ||
public interface InterfaceBiomeSource { | ||
RegistryEntry<DimensionType> biolith$getDimensionType(); | ||
|
||
void biolith$setDimensionType(RegistryEntry<DimensionType> dimensionTypeEntry); | ||
} |
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
27 changes: 27 additions & 0 deletions
27
src/main/java/com/terraformersmc/biolith/impl/mixin/MixinBiomeSource.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,27 @@ | ||
package com.terraformersmc.biolith.impl.mixin; | ||
|
||
import com.terraformersmc.biolith.impl.biome.InterfaceBiomeSource; | ||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.world.biome.source.BiomeSource; | ||
import net.minecraft.world.dimension.DimensionType; | ||
import org.jetbrains.annotations.Nullable; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
|
||
@Mixin(BiomeSource.class) | ||
public class MixinBiomeSource implements InterfaceBiomeSource { | ||
private RegistryEntry<DimensionType> biolith$dimensionTypeEntry; | ||
|
||
@Override | ||
public @Nullable RegistryEntry<DimensionType> biolith$getDimensionType() { | ||
return biolith$dimensionTypeEntry; | ||
} | ||
|
||
@Override | ||
public void biolith$setDimensionType(RegistryEntry<DimensionType> dimensionTypeEntry) { | ||
if (biolith$dimensionTypeEntry != null) { | ||
throw new IllegalStateException("Dimension Type already set: " + biolith$dimensionTypeEntry); | ||
} | ||
|
||
biolith$dimensionTypeEntry = dimensionTypeEntry; | ||
} | ||
} |
18 changes: 18 additions & 0 deletions
18
src/main/java/com/terraformersmc/biolith/impl/mixin/MixinDimensionOptions.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,18 @@ | ||
package com.terraformersmc.biolith.impl.mixin; | ||
|
||
import net.minecraft.registry.entry.RegistryEntry; | ||
import net.minecraft.world.dimension.DimensionOptions; | ||
import net.minecraft.world.dimension.DimensionType; | ||
import net.minecraft.world.gen.chunk.ChunkGenerator; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(DimensionOptions.class) | ||
public class MixinDimensionOptions { | ||
@Inject(method = "<init>", at = @At("RETURN")) | ||
private void biolith$storeDimensionTypeToBiomeSource(RegistryEntry<DimensionType> dimensionTypeEntry, ChunkGenerator chunkGenerator, CallbackInfo ci) { | ||
chunkGenerator.getBiomeSource().biolith$setDimensionType(dimensionTypeEntry); | ||
} | ||
} |
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
Oops, something went wrong.