How to spawn multiple structures from .ntb (structure block file)?

Started by X_Khan_X on

Topic category: Advanced modding

Joined Sep 2019
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to spawn multiple structures from .ntb (structure block file)?

Hello, I'm trying to generate some structure when a particular action is performed, I have this class as Structuregenerator

public class StructureGenerator {

    public static final StructureGen CAGE_TRAP = new StructureGen("cage_trap");
    public static final StructureGen WISHING_WELL = new StructureGen("wishing_well");
public static final StructureGen AMERICAN_FLAG = new StructureGen("american_flag");

    public static void generateStructure(WorldGenerator generator, World world, Random random, int x, int y, int z) {
        BlockPos pos = new BlockPos(x, y, z);
        if (world.getWorldType() != WorldType.FLAT) {
            if (!world.isRemote) {
                generator.generate(world, random, pos);
            }
        }
    }
}

And I use:

StructureGenerator.generateStructure(StructureGenerator.CAGE_TRAP, worldIn, r, player.getPosition().add(3,0,0).getX(),player.getPosition().add(0,-2,0).getY(),player.getPosition().add(0,0,-1).getZ());

But it keeps to spawn me the last Structure added (AMERICAN_FLAG), why? How to fix this?