Merge pull request #2441 from Lazzzycatwastaken/crane

Crane Structure
This commit is contained in:
HbmMods 2025-09-22 11:34:15 +02:00 committed by GitHub
commit bc7e00c71c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 54 additions and 3 deletions

View File

@ -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);

View File

@ -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"));

View File

@ -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);

View File

@ -116,6 +116,40 @@ public class LogicBlockActions {
// world.setBlock(x, y, z, ModBlocks.block_steel); this is useless
};
public static Consumer<LogicBlock.TileEntityLogicBlock> 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<LogicBlock.TileEntityLogicBlock> 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);

View File

@ -43,6 +43,14 @@ public class LogicBlockConditions {
return false;
};
public static Function<LogicBlock.TileEntityLogicBlock, Boolean> 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<LogicBlock.TileEntityLogicBlock, Boolean> 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);

Binary file not shown.