-
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.
Moved world gen to TerrainAPI (new required dependency).
New world gen: - At approx. Y<=64 underground, smaller signalum meteorites now spawn somewhat commonly.
- Loading branch information
1 parent
ca5a557
commit 6e42d53
Showing
10 changed files
with
179 additions
and
70 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
16 changes: 16 additions & 0 deletions
16
...unsetsatellite/signalindustries/api/impl/terrainapi/TerrainAPISignalIndustriesPlugin.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,16 @@ | ||
package sunsetsatellite.signalindustries.api.impl.terrainapi; | ||
|
||
import sunsetsatellite.signalindustries.SignalIndustries; | ||
import useless.terrainapi.api.TerrainAPI; | ||
|
||
public class TerrainAPISignalIndustriesPlugin implements TerrainAPI { | ||
@Override | ||
public String getModID() { | ||
return SignalIndustries.MOD_ID; | ||
} | ||
|
||
@Override | ||
public void onInitialize() { | ||
new WorldGenSI().init(); | ||
} | ||
} |
50 changes: 50 additions & 0 deletions
50
src/main/java/sunsetsatellite/signalindustries/api/impl/terrainapi/WorldGenSI.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,50 @@ | ||
package sunsetsatellite.signalindustries.api.impl.terrainapi; | ||
|
||
import net.minecraft.core.block.Block; | ||
import net.minecraft.core.world.chunk.ChunkCoordinates; | ||
import sunsetsatellite.signalindustries.SignalIndustries; | ||
import sunsetsatellite.signalindustries.worldgen.WorldFeatureGeode; | ||
import sunsetsatellite.signalindustries.worldgen.WorldFeatureMeteor; | ||
import sunsetsatellite.signalindustries.worldgen.WorldFeatureObelisk; | ||
import useless.terrainapi.generation.overworld.OverworldFunctions; | ||
import useless.terrainapi.initialization.BaseInitialization; | ||
import useless.terrainapi.initialization.worldtypes.OverworldInitialization; | ||
|
||
public class WorldGenSI extends BaseInitialization { | ||
@Override | ||
protected void initValues() { | ||
|
||
} | ||
|
||
@Override | ||
protected void initStructure() { | ||
|
||
} | ||
|
||
@Override | ||
protected void initOre() { | ||
|
||
} | ||
|
||
@Override | ||
protected void initRandom() { | ||
OverworldInitialization.randomFeatures.addFeatureSurface(new WorldFeatureMeteor(Block.oreIronBasalt.id,0,25),512); | ||
OverworldInitialization.randomFeatures.addFeatureSurface(new WorldFeatureMeteor(SignalIndustries.signalumOre.id,0,15),1024); | ||
OverworldInitialization.randomFeatures.addFeatureSurface(new WorldFeatureMeteor(SignalIndustries.dilithiumOre.id,0,3),2048); | ||
OverworldInitialization.randomFeatures.addFeatureSurface(new WorldFeatureObelisk(),4096); | ||
OverworldInitialization.randomFeatures.addFeature( | ||
(x) -> new WorldFeatureGeode(SignalIndustries.signalumOre.id,0,10,3), | ||
null, | ||
OverworldFunctions::getStandardBiomesDensity, | ||
new Object[]{1, null}, | ||
32, | ||
0.10f, | ||
0.25f | ||
); | ||
} | ||
|
||
@Override | ||
protected void initBiome() { | ||
|
||
} | ||
} |
59 changes: 0 additions & 59 deletions
59
src/main/java/sunsetsatellite/signalindustries/mixin/ChunkDecoratorOverworldMixin.java
This file was deleted.
Oops, something went wrong.
72 changes: 72 additions & 0 deletions
72
src/main/java/sunsetsatellite/signalindustries/worldgen/WorldFeatureGeode.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,72 @@ | ||
package sunsetsatellite.signalindustries.worldgen; | ||
|
||
|
||
import net.minecraft.core.block.Block; | ||
import net.minecraft.core.lang.I18n; | ||
import net.minecraft.core.world.World; | ||
import net.minecraft.core.world.generate.feature.WorldFeature; | ||
import sunsetsatellite.signalindustries.SignalIndustries; | ||
import sunsetsatellite.signalindustries.entities.ExplosionNoDrops; | ||
|
||
import java.util.Random; | ||
|
||
public class WorldFeatureGeode extends WorldFeature { | ||
|
||
public int oreId; | ||
public int oreMeta; | ||
public int oreChance; | ||
public int radius = 4; | ||
|
||
public WorldFeatureGeode(int oreId, int oreMeta, int oreChance){ | ||
this.oreId = oreId; | ||
this.oreMeta = oreMeta; | ||
this.oreChance = oreChance; | ||
} | ||
|
||
public WorldFeatureGeode(int oreId, int oreMeta, int oreChance, int radius){ | ||
this.oreId = oreId; | ||
this.oreMeta = oreMeta; | ||
this.oreChance = oreChance; | ||
this.radius = radius; | ||
} | ||
@Override | ||
public boolean generate(World world, Random random, int i, int j, int k) { | ||
SignalIndustries.LOGGER.info(String.format("%s Geode at X:%d Y:%d Z:%d", I18n.getInstance().translateNameKey(Block.blocksList[oreId].getLanguageKey(oreMeta)),i,j,k)); | ||
int oreBlocks = 0; | ||
|
||
int radius1 = radius+1; | ||
|
||
for(int x = -radius1+1; x <= radius1; ++x) { | ||
for (int y = -radius1; y <= radius1; ++y) { | ||
for (int z = -radius1; z <= radius1; ++z) { | ||
if (isPointInsideSphere(x, y, z, radius1)) { | ||
world.setBlockAndMetadataWithNotify(x+i, (y+j)-8, z+k, 0, 0); | ||
} | ||
} | ||
} | ||
} | ||
|
||
for(int x = -radius; x <= radius; ++x) { | ||
for(int y = -radius; y <= radius; ++y) { | ||
for(int z = -radius; z <= radius; ++z) { | ||
if (isPointInsideSphere(x, y, z, radius)) { | ||
if (oreId != 0 && random.nextInt(100) < oreChance){ | ||
world.setBlockAndMetadataWithNotify(x+i, (y+j)-8, z+k, oreId, oreMeta); | ||
oreBlocks++; | ||
} else { | ||
world.setBlockAndMetadataWithNotify(x+i, (y+j)-8, z+k, Block.basalt.id, 0); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
//SignalIndustries.LOGGER.info("Meteor contains "+oreBlocks+" ore."); | ||
return true; | ||
} | ||
|
||
public boolean isPointInsideSphere(int x, int y, int z, double radius) { | ||
return x*x + y*y + z*z < radius*radius; | ||
} | ||
|
||
} |
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