diff options
| author | Spacebuilder2020 <spacebuilder2020@users.noreply.github.com> | 2024-08-12 10:14:55 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-08-12 23:14:55 +0700 |
| commit | c7ae290572e761c8ee0c1a2191d6091f8dcf709d (patch) | |
| tree | 662e430957c9ec013244d5000ef7a6ed613977ba /src/main/java/com | |
| parent | 0ac5ccb1384d5e6c56bafe7ae7dd96b653d0df9c (diff) | |
| download | GT5-Unofficial-c7ae290572e761c8ee0c1a2191d6091f8dcf709d.tar.gz GT5-Unofficial-c7ae290572e761c8ee0c1a2191d6091f8dcf709d.tar.bz2 GT5-Unofficial-c7ae290572e761c8ee0c1a2191d6091f8dcf709d.zip | |
Implement dim num agnostic isGenerationAllowed function (#2854)
* Implement dim num agnostic isGenerationAllowed function
Replaces references to old function in as many places as possible
Only reference that can't be changed right now is `E:\MinecraftProjects\GT5-Unofficial\src\main\java\com\github\bartimaeusnek\crossmod\galacticgreg\VoidMinerUtility.java:189`
* Account for unloaded world or null provider by instead doing a dim number check
This route should be avoided when possible.
* Apply Spotless
Diffstat (limited to 'src/main/java/com')
| -rw-r--r-- | src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java index 40c2302fb0..56e67ab9e5 100644 --- a/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java +++ b/src/main/java/com/github/bartimaeusnek/bartworks/system/oregen/BW_WordGenerator.java @@ -18,6 +18,7 @@ import java.util.Random; import net.minecraft.world.ChunkCoordIntPair; import net.minecraft.world.World; +import net.minecraft.world.WorldProvider; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.IChunkProvider; @@ -40,7 +41,7 @@ public class BW_WordGenerator implements IWorldGenerator { new BW_WordGenerator.WorldGenContainer( aX * 16, aZ * 16, - aWorld.provider.dimensionId, + aWorld.provider, aWorld, aChunkGenerator, aChunkProvider).run(); @@ -49,18 +50,18 @@ public class BW_WordGenerator implements IWorldGenerator { public static class WorldGenContainer implements Runnable { public static HashSet<ChunkCoordIntPair> mGenerated = new HashSet<>(2000); - public final int mDimensionType; + public final WorldProvider mWorldProvider; public final World mWorld; public final IChunkProvider mChunkGenerator; public final IChunkProvider mChunkProvider; public int mX; public int mZ; - public WorldGenContainer(int aX, int aZ, int aDimensionType, World aWorld, IChunkProvider aChunkGenerator, - IChunkProvider aChunkProvider) { + public WorldGenContainer(int aX, int aZ, WorldProvider aWorldProvider, World aWorld, + IChunkProvider aChunkGenerator, IChunkProvider aChunkProvider) { this.mX = aX; this.mZ = aZ; - this.mDimensionType = aDimensionType; + this.mWorldProvider = aWorldProvider; this.mWorld = aWorld; this.mChunkGenerator = aChunkGenerator; this.mChunkProvider = aChunkProvider; @@ -102,8 +103,7 @@ public class BW_WordGenerator implements IWorldGenerator { for (int i = 0; i < 256 && temp; i++) { tRandomWeight = random.nextInt(BW_OreLayer.sWeight); for (BW_OreLayer tWorldGen : BW_OreLayer.sList) { - if (!tWorldGen.isGenerationAllowed(this.mWorld, this.mDimensionType, this.mDimensionType)) - continue; + if (!tWorldGen.isGenerationAllowed(this.mWorld, mWorldProvider.getClass())) continue; tRandomWeight -= tWorldGen.mWeight; if (tRandomWeight <= 0) { try { @@ -114,7 +114,7 @@ public class BW_WordGenerator implements IWorldGenerator { this.mWorld, random, "", - this.mDimensionType, + this.mWorldProvider.dimensionId, xCenter, zCenter, this.mChunkGenerator, |
