diff --git a/src/main/java/com/hbm/config/StructureConfig.java b/src/main/java/com/hbm/config/StructureConfig.java index 2ed7b40e3..2f49923f3 100644 --- a/src/main/java/com/hbm/config/StructureConfig.java +++ b/src/main/java/com/hbm/config/StructureConfig.java @@ -51,6 +51,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; @@ -109,6 +110,7 @@ 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); + craneSpawnWeight = CommonConfig.createConfigInt(config, CATEGORY_STRUCTURES, "5.37_craneSpawnWeight", "Spawn weight for crane structure.", 20); 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); diff --git a/src/main/java/com/hbm/main/StructureManager.java b/src/main/java/com/hbm/main/StructureManager.java index a5f70b5cb..8fba653e0 100644 --- a/src/main/java/com/hbm/main/StructureManager.java +++ b/src/main/java/com/hbm/main/StructureManager.java @@ -85,6 +85,8 @@ public class StructureManager { 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 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/world/gen/NTMWorldGenerator.java b/src/main/java/com/hbm/world/gen/NTMWorldGenerator.java index 8d951f8a3..776396f84 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, -10); + spawnWeight = StructureConfig.craneSpawnWeight; + }}); + NBTStructure.registerStructure(0, new SpawnCondition("plane1") {{ canSpawn = biome -> biome.heightVariation <= 0.3F; structure = new JigsawPiece("crashed_plane_1", StructureManager.plane1, -5); 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