Jump to content

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


X_Khan_X

Recommended Posts

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?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.