mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
shit
This commit is contained in:
parent
dd5dc6ed93
commit
10ab382cf6
@ -102,13 +102,13 @@ public class GUIBookLore extends GuiScreen {
|
||||
|
||||
if(argTag.hasNoTags())
|
||||
text = I18nUtil.resolveKey(k + defacto);
|
||||
else {
|
||||
else { //TODO consider caching the text per page
|
||||
List<String> args = new ArrayList();
|
||||
int index = 1;
|
||||
String arg = argTag.getString("a1");
|
||||
|
||||
while(!arg.isEmpty()) {
|
||||
args.add(arg);
|
||||
args.add(I18nUtil.resolveKey(arg)); //TODO check if this works fine
|
||||
index++;
|
||||
arg = argTag.getString("a" + index);
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.hbm.lib;
|
||||
|
||||
import com.hbm.world.gen.MapGenNTMFeatures;
|
||||
import com.hbm.world.gen.NTMWorldGenerator;
|
||||
import com.hbm.world.gen.MapGenSpecialFeatures.SpecialStart;
|
||||
import com.hbm.world.gen.component.BrutalistFeatures;
|
||||
import com.hbm.world.gen.component.BunkerComponents;
|
||||
import com.hbm.world.gen.component.CivilianFeatures;
|
||||
@ -26,6 +27,7 @@ public class HbmWorld {
|
||||
//MapGenStructureIO.func_143031_a(StructureComponentTest.class, "HFR_COMPONENT");
|
||||
MapGenStructureIO.registerStructure(MapGenNTMFeatures.Start.class, "NTMFeatures");
|
||||
MapGenStructureIO.registerStructure(BunkerStart.class, "NTMBunker");
|
||||
MapGenStructureIO.registerStructure(SpecialStart.class, "NTMSpecialFeatures");
|
||||
registerNTMFeatures();
|
||||
|
||||
registerWorldGen(new HbmWorldGen(), 1);
|
||||
|
||||
93
src/main/java/com/hbm/world/gen/MapGenSpecialFeatures.java
Normal file
93
src/main/java/com/hbm/world/gen/MapGenSpecialFeatures.java
Normal file
@ -0,0 +1,93 @@
|
||||
package com.hbm.world.gen;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.world.gen.component.BrutalistFeatures.ElevatedLab1;
|
||||
|
||||
import net.minecraft.world.ChunkCoordIntPair;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.gen.structure.MapGenStructure;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraft.world.gen.structure.StructureComponent;
|
||||
import net.minecraft.world.gen.structure.StructureStart;
|
||||
|
||||
//stuff like the exclusive n rare shipping containers.
|
||||
//it's 'special' because it's not unique but also limited
|
||||
public class MapGenSpecialFeatures extends MapGenStructure {
|
||||
//suuuuuper efficient for .contains()
|
||||
Set<ChunkCoordIntPair> locs = new HashSet<ChunkCoordIntPair>();
|
||||
|
||||
/** String ID for this MapGen */
|
||||
@Override
|
||||
public String func_143025_a() {
|
||||
return "NTMSpecialFeatures";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean canSpawnStructureAtCoords(int chunkX, int chunkZ) {
|
||||
|
||||
if(locs.isEmpty()) {
|
||||
|
||||
Random rand = new Random(this.worldObj.getSeed());
|
||||
double theta = rand.nextDouble() * Math.PI * 2;
|
||||
int ringMax = 4; //each ring of structures has more (and is farther) than the last
|
||||
int ringDist = 1;
|
||||
final int total = 16; //for now
|
||||
//no biome checks necessary, underground caches can always be a backup
|
||||
for(int i = 1; i <= total; i++) {
|
||||
double dist = 312D * (1.25 * ringDist + rand.nextDouble() * 0.5); //5k blocks * random dist in the region of a ring
|
||||
int cX = (int)Math.round(Math.cos(theta) * dist);
|
||||
int cZ = (int)Math.round(Math.sin(theta) * dist);
|
||||
|
||||
ChunkCoordIntPair pair = new ChunkCoordIntPair(cX, cZ);
|
||||
locs.add(pair);
|
||||
|
||||
theta += Math.PI * 2 / ringMax;
|
||||
|
||||
if(i == (ringDist - 1) * 4 + ringMax) {
|
||||
ringDist++;
|
||||
|
||||
if(i + ringDist * 4 > total) //last ring may be sparser, but evenly spaced too
|
||||
ringMax = total - i;
|
||||
else
|
||||
ringMax = ringDist * 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return locs.contains(new ChunkCoordIntPair(chunkX, chunkZ));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected StructureStart getStructureStart(int chunkX, int chunkZ) {
|
||||
return new SpecialStart(this.worldObj, this.rand, chunkX, chunkZ);
|
||||
}
|
||||
|
||||
public static class SpecialStart extends StructureStart {
|
||||
|
||||
public SpecialStart() {}
|
||||
|
||||
public SpecialStart(World world, Random rand, int chunkX, int chunkZ) {
|
||||
super(chunkX, chunkZ);
|
||||
|
||||
//test
|
||||
ElevatedLab1 lab1 = new ElevatedLab1(rand, chunkX * 16 + 8, 64, chunkZ * 16 + 8);
|
||||
this.components.add(lab1);
|
||||
|
||||
if(GeneralConfig.enableDebugMode) {
|
||||
System.out.print("[Debug] StructureStart at " + (chunkX * 16 + 8) + ", " + 64 + ", " + (chunkZ * 16 + 8) + "\n[Debug] Components: ");
|
||||
this.components.forEach((component) -> {
|
||||
System.out.print(MapGenStructureIO.func_143036_a((StructureComponent) component) + " ");
|
||||
});
|
||||
|
||||
System.out.print("\n");
|
||||
}
|
||||
|
||||
this.updateBoundingBox();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -18,14 +18,16 @@ import net.minecraftforge.event.world.WorldEvent;
|
||||
|
||||
public class NTMWorldGenerator implements IWorldGenerator {
|
||||
|
||||
private MapGenNTMFeatures scatteredFeatureGenerator = new MapGenNTMFeatures();
|
||||
private MapGenNTMFeatures scatteredFeatureGen; //looks like it's based! thank god!
|
||||
private MapGenSpecialFeatures specialFeatureGen; //change back if it's actually cringe and throws NPEs
|
||||
|
||||
private final Random rand = new Random(); //A central random, used to cleanly generate our stuff without affecting vanilla or modded seeds.
|
||||
|
||||
/** Inits all MapGen upon the loading of a new world. Hopefully clears out structureMaps and structureData when a different world is loaded. */
|
||||
@SubscribeEvent
|
||||
public void onLoad(WorldEvent.Load event) {
|
||||
scatteredFeatureGenerator = (MapGenNTMFeatures) getModdedMapGen(new MapGenNTMFeatures(), EventType.CUSTOM);
|
||||
scatteredFeatureGen = (MapGenNTMFeatures) getModdedMapGen(new MapGenNTMFeatures(), EventType.CUSTOM);
|
||||
specialFeatureGen = (MapGenSpecialFeatures) getModdedMapGen(new MapGenSpecialFeatures(), EventType.CUSTOM);
|
||||
hasPopulationEvent = false;
|
||||
}
|
||||
|
||||
@ -65,8 +67,11 @@ public class NTMWorldGenerator implements IWorldGenerator {
|
||||
protected void generateOverworldStructures(World world, IChunkProvider chunkProvider, int chunkX, int chunkZ) {
|
||||
Block[] ablock = new Block[65536]; //ablock isn't actually used for anything in MapGenStructure
|
||||
|
||||
this.scatteredFeatureGenerator.func_151539_a(chunkProvider, world, chunkX, chunkZ, ablock);
|
||||
this.scatteredFeatureGenerator.generateStructuresInChunk(world, rand, chunkX, chunkZ);
|
||||
this.scatteredFeatureGen.func_151539_a(chunkProvider, world, chunkX, chunkZ, ablock);
|
||||
this.scatteredFeatureGen.generateStructuresInChunk(world, rand, chunkX, chunkZ);
|
||||
|
||||
this.specialFeatureGen.func_151539_a(chunkProvider, world, chunkX, chunkZ, ablock);
|
||||
this.specialFeatureGen.generateStructuresInChunk(world, rand, chunkX, chunkZ);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user