-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
enable generation in non-vanilla dimensions
- Loading branch information
1 parent
f7efddc
commit 346d5cb
Showing
3 changed files
with
55 additions
and
1 deletion.
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
52 changes: 52 additions & 0 deletions
52
src/main/java/de/pilz/plantmegapackfix/mixins/late/PMPWorldGeneratorMixin.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,52 @@ | ||
package de.pilz.plantmegapackfix.mixins.late; | ||
|
||
import java.util.Random; | ||
|
||
import net.minecraft.world.World; | ||
import net.minecraft.world.WorldProviderEnd; | ||
import net.minecraft.world.WorldProviderHell; | ||
import net.minecraft.world.WorldProviderSurface; | ||
import net.minecraft.world.chunk.IChunkProvider; | ||
|
||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.Shadow; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
import plantmegapack.PlantMegaPack; | ||
|
||
@Mixin(plantmegapack.worldgen.PMPWorldGenerator.class) | ||
public abstract class PMPWorldGeneratorMixin { | ||
|
||
@Shadow(remap = false) | ||
private void generateNether(World world, Random random, int chunkX, int chunkZ) {} | ||
|
||
@Shadow(remap = false) | ||
private void generateSurface(World world, Random random, int chunkX, int chunkZ) {} | ||
|
||
@Shadow(remap = false) | ||
private void generateEnd(World world, Random random, int chunkX, int chunkZ) {} | ||
|
||
@Inject(method = "generate", at = @At("RETURN"), cancellable = false, remap = false) | ||
private void pmpfix$$checkWorldProviderSuface(Random random, int chunkX, int chunkZ, World world, | ||
IChunkProvider chunkGenerator, IChunkProvider chunkProvider, CallbackInfo callback) { | ||
if (world.provider.dimensionId == 0 || world.provider.dimensionId == -1 || world.provider.dimensionId == 1) { | ||
// Handled by original already | ||
return; | ||
} | ||
if (world.provider instanceof WorldProviderSurface) { | ||
if (PlantMegaPack.settingsGeneral.worldgenOverworldRate > 0) { | ||
generateSurface(world, random, chunkX * 16, chunkZ * 16); | ||
} | ||
} else if (world.provider instanceof WorldProviderHell) { | ||
if (PlantMegaPack.settingsGeneral.worldgenNetherRate > 0) { | ||
generateNether(world, random, chunkX * 16, chunkZ * 16); | ||
} | ||
} else if (world.provider instanceof WorldProviderEnd) { | ||
if (PlantMegaPack.settingsGeneral.worldgenOverworldRate > 0) { | ||
generateEnd(world, random, chunkX * 16, chunkZ * 16); | ||
} | ||
} | ||
} | ||
} |