From 1eecfbca8574737548efe7a5ec9e2f4a68df65fe Mon Sep 17 00:00:00 2001 From: Lazzzycatwastaken Date: Fri, 9 May 2025 19:38:11 +0200 Subject: [PATCH] whos getting the best head: A. Alvin B. Theodore C. Simon (Secret option) Me --- .../java/com/hbm/config/StructureConfig.java | 12 ++-- .../java/com/hbm/itempool/ItemPoolsPile.java | 44 +++++++++++--- .../java/com/hbm/main/StructureManager.java | 11 ++++ src/main/java/com/hbm/util/LootGenerator.java | 17 +++++- .../com/hbm/world/gen/NTMWorldGenerator.java | 59 +++++++++++++++++-- 5 files changed, 124 insertions(+), 19 deletions(-) diff --git a/src/main/java/com/hbm/config/StructureConfig.java b/src/main/java/com/hbm/config/StructureConfig.java index 2f6bb9bf9..5ce4c6d51 100644 --- a/src/main/java/com/hbm/config/StructureConfig.java +++ b/src/main/java/com/hbm/config/StructureConfig.java @@ -10,8 +10,8 @@ public class StructureConfig { public static int enableStructures = 2; - public static int structureMinChunks = 8; - public static int structureMaxChunks = 24; + public static int structureMinChunks = 4; + public static int structureMaxChunks = 12; public static double lootAmountFactor = 1D; @@ -25,15 +25,15 @@ public class StructureConfig { enableStructures = CommonConfig.parseStructureFlag(unparsedStructureFlag); - structureMinChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.01_structureMinChunks", "Minimum non-zero distance between structures in chunks (Settings lower than 8 may be problematic).", 8); - structureMaxChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.02_structureMaxChunks", "Maximum non-zero distance between structures in chunks.", 24); + structureMinChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.01_structureMinChunks", "Minimum non-zero distance between structures in chunks (Settings lower than 8 may be problematic).", 4); + structureMaxChunks = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.02_structureMaxChunks", "Maximum non-zero distance between structures in chunks.", 16); lootAmountFactor = CommonConfig.createConfigDouble(config, CATEGORY_STRUCTURES, "5.03_lootAmountFactor", "General factor for loot spawns. Applies to spawned IInventories, not loot blocks.", 1D); debugStructures = CommonConfig.createConfigBool(config, CATEGORY_STRUCTURES, "5.04_debugStructures", "If enabled, special structure blocks like jigsaw blocks will not be transformed after generating", false); - structureMinChunks = CommonConfig.setDef(structureMinChunks, 8); - structureMaxChunks = CommonConfig.setDef(structureMaxChunks, 24); + structureMinChunks = CommonConfig.setDef(structureMinChunks, 4); + structureMaxChunks = CommonConfig.setDef(structureMaxChunks, 12); if(structureMinChunks > structureMaxChunks) { MainRegistry.logger.error("Fatal error config: Minimum value has been set higher than the maximum value!"); diff --git a/src/main/java/com/hbm/itempool/ItemPoolsPile.java b/src/main/java/com/hbm/itempool/ItemPoolsPile.java index ad2a7f3ae..0a4378211 100644 --- a/src/main/java/com/hbm/itempool/ItemPoolsPile.java +++ b/src/main/java/com/hbm/itempool/ItemPoolsPile.java @@ -21,9 +21,10 @@ public class ItemPoolsPile { public static final String POOL_PILE_MAKESHIFT_PLATES = "POOL_PILE_MAKESHIFT_PLATES"; public static final String POOL_PILE_MAKESHIFT_WIRE = "POOL_PILE_MAKESHIFT_WIRE"; public static final String POOL_PILE_NUKE_STORAGE = "POOL_PILE_NUKE_STORAGE"; - + public static final String POOL_PILE_OF_GARBAGE = "POOL_PILE_OF_GARBAGE"; + public static void init() { - + //items found in glyphid hives new ItemPool(POOL_PILE_HIVE) {{ this.pool = new WeightedRandomChestContent[] { @@ -56,7 +57,7 @@ public class ItemPoolsPile { weighted(Items.experience_bottle, 0, 1, 3, 5), }; }}; - + //items found in glyphid bone piles new ItemPool(POOL_PILE_BONES) {{ this.pool = new WeightedRandomChestContent[] { @@ -65,7 +66,7 @@ public class ItemPoolsPile { weighted(ModItems.biomass, 0, 1, 1, 2) }; }}; - + //bottlecap stashess new ItemPool(POOL_PILE_CAPS) {{ this.pool = new WeightedRandomChestContent[] { @@ -74,7 +75,7 @@ public class ItemPoolsPile { weighted(ModItems.cap_sparkle, 0, 4, 4, 1), }; }}; - + //medicine stashes new ItemPool(POOL_PILE_MED_SYRINGE) {{ this.pool = new WeightedRandomChestContent[] { @@ -91,13 +92,13 @@ public class ItemPoolsPile { weighted(ModItems.siox, 0, 1, 1, 5), }; }}; - + //makeshift gun new ItemPool(POOL_PILE_MAKESHIFT_GUN) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.gun_maresleg, 0, 1, 1, 10) }; }}; new ItemPool(POOL_PILE_MAKESHIFT_WRENCH) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.wrench, 0, 1, 1, 10) }; }}; new ItemPool(POOL_PILE_MAKESHIFT_PLATES) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.plate_steel, 0, 1, 1, 10) }; }}; new ItemPool(POOL_PILE_MAKESHIFT_WIRE) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.wire_fine, Mats.MAT_ALUMINIUM.id, 1, 1, 10) }; }}; - + new ItemPool(POOL_PILE_NUKE_STORAGE) {{ this.pool = new WeightedRandomChestContent[] { weighted(ModItems.ammo_standard, EnumAmmo.NUKE_STANDARD.ordinal(), 1, 1, 50), @@ -106,5 +107,34 @@ public class ItemPoolsPile { }; }}; + + new ItemPool(POOL_PILE_OF_GARBAGE) {{ + this.pool = new WeightedRandomChestContent[] { + weighted(ModItems.pipe, 2600, 0, 2, 20), + weighted(ModItems.scrap, 0, 1, 5, 20), + weighted(ModItems.wire_fine, 8200, 1, 2, 20), + weighted(ModItems.dust, 0, 1, 3, 40), + weighted(ModItems.dust_tiny, 0, 1, 7, 40), + weighted(ModItems.powder_cement, 0, 1, 6, 40), + weighted(ModItems.nugget_lead, 0, 0, 3, 20), + weighted(ModItems.wire_fine, 0, 0, 3, 20), + weighted(ModItems.powder_ash, 0, 0, 1, 15), + weighted(ModItems.plate_lead, 0, 0, 1, 15), + weighted(Items.string, 0, 0, 1, 15), + weighted(ModItems.bolt, 8200, 0, 2, 15), + weighted(ModItems.pin, 0, 0, 2, 15), + weighted(ModItems.cap_nuka, 0, 0, 8, 15), + weighted(ModItems.plate_iron, 0, 0, 2, 15), + weighted(ModItems.fallout, 0, 0, 2, 15), + weighted(ModItems.coil_tungsten, 0, 0, 2, 15), + weighted(ModItems.can_empty, 0, 0, 1, 15), + weighted(ModItems.ingot_asbestos, 0, 0, 1, 15), + weighted(ModItems.syringe_metal_empty, 0, 0, 1, 15), + weighted(ModItems.syringe_empty, 0, 0, 1, 15), + weighted(ModItems.pipe_lead, 0, 0, 1, 5), + weighted(ModItems.motor, 0, 0, 1, 5), + weighted(ModItems.canned_conserve, 2, 0, 1, 5), + }; + }}; } } diff --git a/src/main/java/com/hbm/main/StructureManager.java b/src/main/java/com/hbm/main/StructureManager.java index 5c3f93090..c9f840b76 100644 --- a/src/main/java/com/hbm/main/StructureManager.java +++ b/src/main/java/com/hbm/main/StructureManager.java @@ -62,6 +62,17 @@ public class StructureManager { public static final NBTStructure lighthouse = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/lighthouse.nbt")); public static final NBTStructure dish = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/dish.nbt")); + public static final NBTStructure ntmruinsA = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsA.nbt")); + public static final NBTStructure ntmruinsB = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsB.nbt")); + public static final NBTStructure ntmruinsC = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsC.nbt")); + public static final NBTStructure ntmruinsD = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsD.nbt")); + public static final NBTStructure ntmruinsE = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsE.nbt")); + public static final NBTStructure ntmruinsF = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsF.nbt")); + public static final NBTStructure ntmruinsG = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsG.nbt")); + public static final NBTStructure ntmruinsH = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsH.nbt")); + public static final NBTStructure ntmruinsI = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsI.nbt")); + public static final NBTStructure ntmruinsJ = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/ntmruinsJ.nbt")); + public static final NBTStructure spire = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/spire.nbt")); // public static final NBTStructure test_rot = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/test-rot.nbt")); diff --git a/src/main/java/com/hbm/util/LootGenerator.java b/src/main/java/com/hbm/util/LootGenerator.java index b14306b9e..586ff6295 100644 --- a/src/main/java/com/hbm/util/LootGenerator.java +++ b/src/main/java/com/hbm/util/LootGenerator.java @@ -28,6 +28,7 @@ public class LootGenerator { public static final String LOOT_BONES = "LOOT_BONES"; public static final String LOOT_GLYPHID_HIVE = "LOOT_GLYPHID_HIVE"; public static final String LOOT_METEOR = "LOOT_METEOR"; + public static final String LOOT_SHIT = "LOOT_SHIT"; public static void applyLoot(World world, int x, int y, int z, String name) { switch(name) { @@ -40,6 +41,7 @@ public class LootGenerator { case LOOT_BONES: lootBones(world, x, y, z); case LOOT_GLYPHID_HIVE: lootGlyphidHive(world, x, y, z); case LOOT_METEOR: lootBookMeteor(world, x, y, z); + case LOOT_SHIT: lootShit(world, x, y, z); default: lootBones(world, x, y, z); break; } } @@ -55,6 +57,7 @@ public class LootGenerator { LOOT_BONES, LOOT_GLYPHID_HIVE, LOOT_METEOR, + LOOT_SHIT, }; } @@ -211,4 +214,16 @@ public class LootGenerator { } } -} \ No newline at end of file + public static void lootShit(World world, int x, int y, int z) { + + TileEntityLoot loot = (TileEntityLoot) world.getTileEntity(x, y, z); + + if(loot != null && loot.items.isEmpty()) { + + int limit = world.rand.nextInt(3) + 3; + for(int i = 0; i < limit; i++) { + addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPool.getPool(ItemPoolsPile.POOL_PILE_OF_GARBAGE), world.rand), world.rand.nextDouble() - 0.5, i * 0.03125, world.rand.nextDouble() - 0.5); + } + } + } +} diff --git a/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java index bb1c7b3d3..cbbf13197 100644 --- a/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java +++ b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java @@ -46,7 +46,7 @@ public class NTMWorldGenerator implements IWorldGenerator { structure = new JigsawPiece("spire", StructureManager.spire, -1); spawnWeight = 2; }}); - + NBTStructure.registerStructure(0, new SpawnCondition() {{ canSpawn = biome -> !invalidBiomes.contains(biome); start = d -> new MapGenNTMFeatures.Start(d.getW(), d.getX(), d.getY(), d.getZ()); @@ -102,8 +102,7 @@ public class NTMWorldGenerator implements IWorldGenerator { spawnWeight = 8; }}); - NBTStructure.registerNullWeight(0, 2, oceanBiomes::contains); //why the fuck did this change - + NBTStructure.registerStructure(0, new SpawnCondition() {{ canSpawn = biome -> biome == BiomeGenBase.plains; structure = new JigsawPiece("dish", StructureManager.dish, -10); @@ -112,8 +111,58 @@ public class NTMWorldGenerator implements IWorldGenerator { spawnWeight = 1; }}); - NBTStructure.registerNullWeight(0, 2, biome -> biome == BiomeGenBase.plains); - NBTStructure.registerNullWeight(0, 2, oceanBiomes::contains); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsA", StructureManager.ntmruinsA, -1) {{conformToTerrain = true;}}; + spawnWeight = 20; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsB", StructureManager.ntmruinsB, -1) {{conformToTerrain = true;}}; + spawnWeight = 25; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsC", StructureManager.ntmruinsC, -1) {{conformToTerrain = true;}}; + spawnWeight = 25; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsD", StructureManager.ntmruinsD, -1) {{conformToTerrain = true;}}; + spawnWeight = 30; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsE", StructureManager.ntmruinsE, -1) {{conformToTerrain = true;}}; + spawnWeight = 30; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsF", StructureManager.ntmruinsF, -1) {{conformToTerrain = true;}}; + spawnWeight = 50; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsG", StructureManager.ntmruinsG, -1) {{conformToTerrain = true;}}; + spawnWeight = 50; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsH", StructureManager.ntmruinsH, -1) {{conformToTerrain = true;}}; + spawnWeight = 50; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsI", StructureManager.ntmruinsI, -1) {{conformToTerrain = true;}}; + spawnWeight = 50; + }}); + NBTStructure.registerStructure(0, new SpawnCondition() {{ + canSpawn = biome -> !invalidBiomes.contains(biome) && biome.canSpawnLightningBolt(); + structure = new JigsawPiece("NTMRuinsJ", StructureManager.ntmruinsJ, -1) {{conformToTerrain = true;}}; + spawnWeight = 35; + }}); + + NBTStructure.registerNullWeight(0, 4, oceanBiomes::contains); Map bricks = new HashMap() {{ put(ModBlocks.meteor_brick, new MeteorBricks());