mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
improved meteor dungeon stair piece, added loot fallback, and prevent structures generating too far horizontally from the start point
This commit is contained in:
parent
977bd3e2b5
commit
7f0c483cb1
@ -48,6 +48,7 @@ public class StructureManager {
|
|||||||
public static final NBTStructure meteor_dragon_tesla = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/meteor/room10/headloot/loot-tesla.nbt"));
|
public static final NBTStructure meteor_dragon_tesla = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/meteor/room10/headloot/loot-tesla.nbt"));
|
||||||
public static final NBTStructure meteor_dragon_trap = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/meteor/room10/headloot/loot-trap.nbt"));
|
public static final NBTStructure meteor_dragon_trap = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/meteor/room10/headloot/loot-trap.nbt"));
|
||||||
public static final NBTStructure meteor_dragon_crate_crab = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/meteor/room10/headloot/loot-crate-crab.nbt"));
|
public static final NBTStructure meteor_dragon_crate_crab = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/meteor/room10/headloot/loot-crate-crab.nbt"));
|
||||||
|
public static final NBTStructure meteor_dragon_fallback = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/meteor/room10/headloot/loot-fallback.nbt"));
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -650,6 +650,10 @@ public class NBTStructure {
|
|||||||
// Maximum amount of components in this structure
|
// Maximum amount of components in this structure
|
||||||
public int sizeLimit = 8;
|
public int sizeLimit = 8;
|
||||||
|
|
||||||
|
// How far the structure can extend horizontally from the center, maximum of 128
|
||||||
|
// This could be increased by changing GenStructure:range from 8, but this is already quite reasonably large
|
||||||
|
public int rangeLimit = 128;
|
||||||
|
|
||||||
// Height modifiers, will clamp height that the start generates at, allowing for:
|
// Height modifiers, will clamp height that the start generates at, allowing for:
|
||||||
// * Submarines that must spawn under the ocean surface
|
// * Submarines that must spawn under the ocean surface
|
||||||
// * Bunkers that sit underneath the ground
|
// * Bunkers that sit underneath the ground
|
||||||
@ -967,7 +971,8 @@ public class NBTStructure {
|
|||||||
|
|
||||||
if(fromComponent.piece.structure.fromConnections == null) continue;
|
if(fromComponent.piece.structure.fromConnections == null) continue;
|
||||||
|
|
||||||
boolean fallbacksOnly = this.components.size() >= spawn.sizeLimit;
|
int distance = getDistanceTo(fromComponent.getBoundingBox());
|
||||||
|
boolean fallbacksOnly = this.components.size() >= spawn.sizeLimit || distance >= spawn.rangeLimit;
|
||||||
|
|
||||||
for(List<JigsawConnection> unshuffledList : fromComponent.piece.structure.fromConnections) {
|
for(List<JigsawConnection> unshuffledList : fromComponent.piece.structure.fromConnections) {
|
||||||
List<JigsawConnection> connectionList = new ArrayList<>(unshuffledList);
|
List<JigsawConnection> connectionList = new ArrayList<>(unshuffledList);
|
||||||
@ -1013,7 +1018,7 @@ public class NBTStructure {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(GeneralConfig.enableDebugMode) {
|
if(GeneralConfig.enableDebugMode) {
|
||||||
MainRegistry.logger.info("[Debug] Spawning NBT structure at: " + chunkX * 16 + ", " + chunkZ * 16);
|
MainRegistry.logger.info("[Debug] Spawning NBT structure with " + components.size() + " piece(s) at: " + chunkX * 16 + ", " + chunkZ * 16);
|
||||||
String componentList = "[Debug] Components: ";
|
String componentList = "[Debug] Components: ";
|
||||||
for(Object component : this.components) {
|
for(Object component : this.components) {
|
||||||
componentList += ((Component) component).piece.structure.name + " ";
|
componentList += ((Component) component).piece.structure.name + " ";
|
||||||
@ -1070,6 +1075,13 @@ public class NBTStructure {
|
|||||||
return nextPiece.structure.toHorizontalConnections.get(fromConnection.targetName);
|
return nextPiece.structure.toHorizontalConnections.get(fromConnection.targetName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private int getDistanceTo(StructureBoundingBox box) {
|
||||||
|
int x = box.getCenterX();
|
||||||
|
int z = box.getCenterZ();
|
||||||
|
|
||||||
|
return Math.max(Math.abs(x - (func_143019_e() << 4)), Math.abs(z - (func_143018_f() << 4)));
|
||||||
|
}
|
||||||
|
|
||||||
// post loading, update parent reference for loaded components
|
// post loading, update parent reference for loaded components
|
||||||
@Override
|
@Override
|
||||||
public void func_143017_b(NBTTagCompound nbt) {
|
public void func_143017_b(NBTTagCompound nbt) {
|
||||||
|
|||||||
@ -50,23 +50,23 @@ public class NTMWorldGenerator implements IWorldGenerator {
|
|||||||
}});
|
}});
|
||||||
|
|
||||||
Map<Block, BlockSelector> bricks = new HashMap<Block, BlockSelector>() {{
|
Map<Block, BlockSelector> bricks = new HashMap<Block, BlockSelector>() {{
|
||||||
put(ModBlocks.meteor_brick, new MeteorBricks());
|
put(ModBlocks.meteor_brick, new MeteorBricks());
|
||||||
}};
|
}};
|
||||||
Map<Block, BlockSelector> crates = new HashMap<Block, BlockSelector>() {{
|
Map<Block, BlockSelector> crates = new HashMap<Block, BlockSelector>() {{
|
||||||
put(ModBlocks.meteor_brick, new MeteorBricks());
|
put(ModBlocks.meteor_brick, new MeteorBricks());
|
||||||
put(ModBlocks.crate, new SupplyCrates());
|
put(ModBlocks.crate, new SupplyCrates());
|
||||||
put(ModBlocks.meteor_spawner, new CrabSpawners());
|
put(ModBlocks.meteor_spawner, new CrabSpawners());
|
||||||
}};
|
}};
|
||||||
Map<Block, BlockSelector> ooze = new HashMap<Block, BlockSelector>() {{
|
Map<Block, BlockSelector> ooze = new HashMap<Block, BlockSelector>() {{
|
||||||
put(ModBlocks.meteor_brick, new MeteorBricks());
|
put(ModBlocks.meteor_brick, new MeteorBricks());
|
||||||
put(ModBlocks.concrete_colored, new GreenOoze());
|
put(ModBlocks.concrete_colored, new GreenOoze());
|
||||||
}};
|
}};
|
||||||
|
|
||||||
NBTStructure.registerStructure(0, new SpawnCondition() {{
|
NBTStructure.registerStructure(0, new SpawnCondition() {{
|
||||||
minHeight = 32;
|
minHeight = 32;
|
||||||
maxHeight = 32;
|
maxHeight = 32;
|
||||||
sizeLimit = 128;
|
sizeLimit = 128;
|
||||||
canSpawn = biome -> biome.rootHeight >= 0;
|
canSpawn = biome -> biome.rootHeight >= 0;
|
||||||
startPool = "start";
|
startPool = "start";
|
||||||
pools = new HashMap<String, NBTStructure.JigsawPool>() {{
|
pools = new HashMap<String, NBTStructure.JigsawPool>() {{
|
||||||
put("start", new JigsawPool() {{
|
put("start", new JigsawPool() {{
|
||||||
@ -116,6 +116,7 @@ public class NTMWorldGenerator implements IWorldGenerator {
|
|||||||
add(new JigsawPiece("meteor_dragon_tesla", StructureManager.meteor_dragon_tesla) {{ blockTable = crates; }}, 1);
|
add(new JigsawPiece("meteor_dragon_tesla", StructureManager.meteor_dragon_tesla) {{ blockTable = crates; }}, 1);
|
||||||
add(new JigsawPiece("meteor_dragon_trap", StructureManager.meteor_dragon_trap) {{ blockTable = crates; }}, 1);
|
add(new JigsawPiece("meteor_dragon_trap", StructureManager.meteor_dragon_trap) {{ blockTable = crates; }}, 1);
|
||||||
add(new JigsawPiece("meteor_dragon_crate_crab", StructureManager.meteor_dragon_crate_crab) {{ blockTable = crates; }}, 1);
|
add(new JigsawPiece("meteor_dragon_crate_crab", StructureManager.meteor_dragon_crate_crab) {{ blockTable = crates; }}, 1);
|
||||||
|
fallback = "headback";
|
||||||
}});
|
}});
|
||||||
put("fallback", new JigsawPool() {{
|
put("fallback", new JigsawPool() {{
|
||||||
add(new JigsawPiece("meteor_fallback", StructureManager.meteor_fallback) {{ blockTable = bricks; }}, 1);
|
add(new JigsawPiece("meteor_fallback", StructureManager.meteor_fallback) {{ blockTable = bricks; }}, 1);
|
||||||
@ -123,6 +124,9 @@ public class NTMWorldGenerator implements IWorldGenerator {
|
|||||||
put("roomback", new JigsawPool() {{
|
put("roomback", new JigsawPool() {{
|
||||||
add(new JigsawPiece("meteor_room_fallback", StructureManager.meteor_room_fallback) {{ blockTable = bricks; }}, 1);
|
add(new JigsawPiece("meteor_room_fallback", StructureManager.meteor_room_fallback) {{ blockTable = bricks; }}, 1);
|
||||||
}});
|
}});
|
||||||
|
put("headback", new JigsawPool() {{
|
||||||
|
add(new JigsawPiece("meteor_loot_fallback", StructureManager.meteor_dragon_fallback) {{ blockTable = crates; }}, 1);
|
||||||
|
}});
|
||||||
}};
|
}};
|
||||||
}});
|
}});
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user