Merge pull request #3039 from 70000hp/crane_mod_pr

Crane Modifications
This commit is contained in:
HbmMods 2026-07-23 11:56:44 +02:00 committed by GitHub
commit 215c89df2e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 38 additions and 8 deletions

View File

@ -30,6 +30,7 @@ public class ItemPoolsPile {
public static final String POOL_PILE_OF_GARBAGE = "POOL_PILE_OF_GARBAGE";
public static final String POOL_PILE_MECHANICAL = "POOL_PILE_MECHANICAL";
public static final String POOL_PILE_GEAR = "POOL_PILE_GEAR";
public static final String POOL_PILE_SUPPLIES = "POOL_PILE_SUPPLIES";
public static void init() {
@ -173,5 +174,17 @@ public class ItemPoolsPile {
weighted(ModItems.taurun_boots, 0, 1, 1, 20)
};
}};
new ItemPool(POOL_PILE_SUPPLIES) {{
this.pool = new WeightedRandomChestContent[] {
weighted(ItemGrenadeUniversal.make(EnumGrenadeShell.FRAG, EnumGrenadeFilling.HE, EnumGrenadeFuze.S3, EnumGrenadeExtra.FRAG_SLEEVE), 3, 5, 10),
weighted(ItemGrenadeUniversal.make(EnumGrenadeShell.FRAG, EnumGrenadeFilling.HE, EnumGrenadeFuze.S3, EnumGrenadeExtra.FRAG_SLEEVE), 3, 5, 10),
weighted(ItemGrenadeUniversal.make(EnumGrenadeShell.FRAG, EnumGrenadeFilling.HE, EnumGrenadeFuze.S3, EnumGrenadeExtra.FRAG_SLEEVE), 3, 5, 10),
weighted(ModItems.syringe_metal_stimpak, 0, 3, 5, 30),
weighted(ModItems.syringe_metal_psycho, 0, 3, 5, 30),
weighted(ModItems.syringe_antidote, 0, 1, 2, 30),
weighted(ModItems.ammo_container, 0, 2, 3, 40)
};
}};
}
}

View File

@ -32,6 +32,7 @@ public class LootGenerator {
public static final String LOOT_SHIT = "LOOT_SHIT";
public static final String LOOT_MECHANICAL = "LOOT_MECHANICAL";
public static final String LOOT_GEAR = "LOOT_GEAR";
public static final String LOOT_SUPPLIES = "LOOT_SUPPLIES";
public static void applyLoot(World world, int x, int y, int z, String name) {
switch(name) {
@ -47,7 +48,8 @@ public class LootGenerator {
case LOOT_FLAREGUN: lootFlareGun(world, x, y, z);
case LOOT_SHIT: lootShit(world, x, y, z);
case LOOT_MECHANICAL: lootMechanical(world, x, y, z);
case LOOT_GEAR: lootMechanical(world, x, y, z);
case LOOT_GEAR: lootGear(world, x, y, z);
case LOOT_SUPPLIES: lootSupplies(world, x, y, z);
default: lootBones(world, x, y, z); break;
}
}
@ -65,8 +67,10 @@ public class LootGenerator {
LOOT_METEOR,
LOOT_FLAREGUN,
LOOT_MECHANICAL,
LOOT_GEAR,
LOOT_SHIT,
LOOT_GEAR,
LOOT_SUPPLIES
};
}
@ -280,4 +284,17 @@ public class LootGenerator {
}
}
}
public static void lootSupplies(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) + 4;
for(int i = 0; i < limit; i++) {
addItemWithDeviation(loot, world.rand, ItemPool.getStack(ItemPool.getPool(ItemPoolsPile.POOL_PILE_SUPPLIES), world.rand), world.rand.nextDouble() - 0.5, i * 0.03125, world.rand.nextDouble() - 0.5);
}
}
}
}

View File

@ -34,12 +34,12 @@ import net.minecraftforge.event.world.WorldEvent;
public class NTMWorldGenerator implements IWorldGenerator {
boolean regTest = false;
/** Includes all biomes tagged as ocean or river */
public static boolean isWaterBiome(BiomeGenBase biome) {
return BiomeDictionary.isBiomeOfType(biome, Type.WATER);
}
/** Includes biomes with little height variation and sparse vegetation, excludes water biomes */
public static boolean isFlatBiome(BiomeGenBase biome) {
return biome.heightVariation <= 0.2F && !isWaterBiome(biome) && BiomeDictionary.isBiomeOfType(biome, Type.SPARSE);
@ -144,17 +144,17 @@ public class NTMWorldGenerator implements IWorldGenerator {
}});
NBTStructure.registerStructure(0, new SpawnCondition("factory") {{
canSpawn = biome -> isFlatBiome(biome);
canSpawn = biome -> biome.heightVariation <= 0.2F && !isWaterBiome(biome);
structure = new JigsawPiece("factory", StructureManager.factory, -10);
spawnWeight = StructureConfig.factorySpawnWeight;
}});
NBTStructure.registerStructure(0, new SpawnCondition("crane") {{
canSpawn = biome -> isFlatBiome(biome);
structure = new JigsawPiece("crane", StructureManager.crane, -9);
canSpawn = biome -> biome.heightVariation <= 0.2F && !isWaterBiome(biome);
structure = new JigsawPiece("crane", StructureManager.crane, -13);
spawnWeight = StructureConfig.craneSpawnWeight;
}});
NBTStructure.registerStructure(0, new SpawnCondition("broadcaster_tower") {{
canSpawn = biome -> isFlatBiome(biome);
structure = new JigsawPiece("broadcaster_tower", StructureManager.broadcasting_tower, -9);