diff --git a/src/main/java/com/hbm/config/StructureConfig.java b/src/main/java/com/hbm/config/StructureConfig.java index fd24e8940..279cf0a52 100644 --- a/src/main/java/com/hbm/config/StructureConfig.java +++ b/src/main/java/com/hbm/config/StructureConfig.java @@ -52,6 +52,7 @@ public class StructureConfig { public static int forestPostSpawnWeight = 30; public static int spireSpawnWeight = 2; + public static int craneSpawnWeight = 20; public static int bunkerSpawnWeight = 6; public static int dishSpawnWeight = 20; public static int featuresSpawnWeight = 50; @@ -110,10 +111,10 @@ public class StructureConfig { ruinsJSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.34_ruinJSpawnWeight", "Spawn weight for ruin J structure.", 12); radioSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.35_radioSpawnWeight", "Spawn weight for radio structure.", 25); factorySpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.36_factorySpawnWeight", "Spawn weight for factory structure.", 40); - broadcastingTowerSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.40_broadcastingTowerSpawnWeight", "Spawn weight for broadcasting tower structure.", 25); - plainsNullWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.37_plainsNullWeight", "Null spawn weight for plains biome", 20); oceanNullWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.38_oceanNullWeight", "Null spawn weight for ocean biomes", 35); + craneSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.39_craneSpawnWeight", "Spawn weight for crane structure.", 20); + broadcastingTowerSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.40_broadcastingTowerSpawnWeight", "Spawn weight for broadcasting tower structure.", 25); structureMinChunks = CommonConfig.setDef(structureMinChunks, 4); diff --git a/src/main/java/com/hbm/main/StructureManager.java b/src/main/java/com/hbm/main/StructureManager.java index 7eca722ed..8f850de22 100644 --- a/src/main/java/com/hbm/main/StructureManager.java +++ b/src/main/java/com/hbm/main/StructureManager.java @@ -84,7 +84,7 @@ public class StructureManager { public static final NBTStructure plane2 = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/crashed_plane_2.nbt")); public static final NBTStructure factory = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/factory.nbt")); - + public static final NBTStructure crane = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/crane.nbt")); public static final NBTStructure broadcasting_tower = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/broadcasting_tower.nbt")); public static final NBTStructure spire = new NBTStructure(new ResourceLocation(RefStrings.MODID, "structures/spire.nbt")); diff --git a/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java index 7cf25d9fb..c6abdbc8b 100644 --- a/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java +++ b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java @@ -145,6 +145,12 @@ public class NTMWorldGenerator implements IWorldGenerator { spawnWeight = StructureConfig.factorySpawnWeight; }}); + NBTStructure.registerStructure(0, new SpawnCondition("crane") {{ + canSpawn = flatbiomes::contains; + structure = new JigsawPiece("crane", StructureManager.crane, -9); + spawnWeight = StructureConfig.craneSpawnWeight; + }}); + NBTStructure.registerStructure(0, new SpawnCondition("broadcaster_tower") {{ canSpawn = flatbiomes::contains; structure = new JigsawPiece("broadcaster_tower", StructureManager.broadcasting_tower, -9); diff --git a/src/main/java/com/hbm/world/gen/util/LogicBlockActions.java b/src/main/java/com/hbm/world/gen/util/LogicBlockActions.java index 7e5b8df3e..50f99aec2 100644 --- a/src/main/java/com/hbm/world/gen/util/LogicBlockActions.java +++ b/src/main/java/com/hbm/world/gen/util/LogicBlockActions.java @@ -116,6 +116,40 @@ public class LogicBlockActions { // world.setBlock(x, y, z, ModBlocks.block_steel); this is useless }; + public static Consumer COLLAPSE_ROOF_RAD_10 = (tile) -> { + World world = tile.getWorldObj(); + int x = tile.xCoord; + int y = tile.yCoord; + int z = tile.zCoord; + + if(tile.phase == 0) return; + + int r = 8; + int r2 = r * r; + int r22 = r2 / 2; + + for (int xx = -r; xx < r; xx++) { + int X = xx + x; + int XX = xx * xx; + for (int yy = -r; yy < r; yy++) { + int Y = yy + y; + int YY = XX + yy * yy; + for (int zz = -r; zz < r; zz++) { + int Z = zz + z; + int ZZ = YY + zz * zz; + if (ZZ < r22) { + + if (world.getBlock(X, Y, Z).getExplosionResistance(null) <= 70) { + EntityFallingBlockNT entityfallingblock = new EntityFallingBlockNT(world, X + 0.5, Y + 0.5, Z + 0.5, world.getBlock(X, Y, Z), world.getBlockMetadata(X, Y, Z)); + world.spawnEntityInWorld(entityfallingblock); + } + } + } + } + } + world.setBlock(x, y, z, Blocks.air); + }; + public static Consumer FODDER_WAVE = (tile) -> { World world = tile.getWorldObj(); int x = tile.xCoord; @@ -342,6 +376,7 @@ public class LogicBlockActions { actions.put("FODDER_WAVE", FODDER_WAVE); actions.put("ABERRATOR", PHASE_ABERRATOR); actions.put("COLLAPSE_ROOF_RAD_5", COLLAPSE_ROOF_RAD_5); + actions.put("COLLAPSE_ROOF_RAD_10", COLLAPSE_ROOF_RAD_10); actions.put("PUZZLE_TEST", PUZZLE_TEST); actions.put("MISSILE_STRIKE", MISSILE_STRIKE); actions.put("IRRADIATE_ENTITIES_AOE", RAD_CONTAINMENT_SYSTEM); diff --git a/src/main/java/com/hbm/world/gen/util/LogicBlockConditions.java b/src/main/java/com/hbm/world/gen/util/LogicBlockConditions.java index f3eec59bb..b9bc15370 100644 --- a/src/main/java/com/hbm/world/gen/util/LogicBlockConditions.java +++ b/src/main/java/com/hbm/world/gen/util/LogicBlockConditions.java @@ -43,6 +43,14 @@ public class LogicBlockConditions { return false; }; + public static Function PLAYER_CUBE_3 = (tile) -> { + World world = tile.getWorldObj(); + int x = tile.xCoord; + int y = tile.yCoord; + int z = tile.zCoord; + return !world.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y - 2, z + 1).expand(3, 3, 3)).isEmpty(); + }; + public static Function PLAYER_CUBE_5 = (tile) -> { World world = tile.getWorldObj(); int x = tile.xCoord; @@ -97,6 +105,7 @@ public class LogicBlockConditions { //example conditions conditions.put("EMPTY", EMPTY); conditions.put("ABERRATOR", ABERRATOR); + conditions.put("PLAYER_CUBE_3", PLAYER_CUBE_3); conditions.put("PLAYER_CUBE_5", PLAYER_CUBE_5); conditions.put("PLAYER_CUBE_25", PLAYER_CUBE_25); conditions.put("REDSTONE", REDSTONE); diff --git a/src/main/resources/assets/hbm/structures/crane.nbt b/src/main/resources/assets/hbm/structures/crane.nbt new file mode 100644 index 000000000..5cde5147d Binary files /dev/null and b/src/main/resources/assets/hbm/structures/crane.nbt differ