Jump to content

Recommended Posts

Posted

I'm trying to let some structures spawn via vanilla worldgen. I have a class implementing IWorldGenerator and added stuff to generate the structure. I think i have to register it somewhere but i dont know where and how. Can someone help?

Posted
4 minutes ago, Crack3dC0d3 said:

But it didnt spawn. Not at all. Any help?

Huh? Help with what I don't see what I could help with. You've provided no way for me to provide actual assistance.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Alright, I''m trying to spawn trees in my normal world. I already got the nbt files but i cant seem to fix how the "Feature" class works. (If i'm actually supposed to use that one) heres my code now

 

public class SilverwoodFeature extends Feature<NoFeatureConfig> {
    public SilverwoodFeature(Function<Dynamic<?>, ? extends NoFeatureConfig> configFactoryIn) {
        super(configFactoryIn);
    }

    @Override
    public boolean place(IWorld world, ChunkGenerator<? extends GenerationSettings> generator, Random random, BlockPos spawnPos, NoFeatureConfig config) {
        ServerWorld worldserver = (ServerWorld) world;
        TemplateManager templatemanager = worldserver.getStructureTemplateManager();
        Template template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/greatwoodtree"));
        int h = ThreadLocalRandom.current().nextInt(0, 7);
        switch(h) {
            case 1: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood1")); break;
            case 2: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood2")); break;
            case 3: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood3")); break;
            case 4: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood4")); break;
            case 5: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood5")); break;
            case 6: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood6")); break;
            case 7: template = templatemanager.getTemplate(new ResourceLocation("arcana", "trees/silverwood/silverwood7")); break;
        }

        if(random.nextInt(1) != 0 || world.getBiome(spawnPos) != Biomes.PLAINS) {
            return false;
        }

        if(template == null) {
            Constants.LOGGER.error("Could not find structure at " + new ResourceLocation("arcana:structures/trees/greatwood"));
            return false;
        }
        PlacementSettings placementsettings = (new PlacementSettings()).setMirror(Mirror.NONE)
                .setRotation(Rotation.NONE).setIgnoreEntities(false).setChunk(null);

        template.addBlocksToWorld(world, spawnPos.add(-4, 0, -4), placementsettings);
        return true;
    }
Posted
11 hours ago, Crack3dC0d3 said:

.setChunk(null);

You may want to set the chunk to the chunk you are in.You can get it from the IWorld parameter using the BlockPos parameter you were given.

 

11 hours ago, Crack3dC0d3 said:

I already got the nbt files

Where are they located?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
11 hours ago, Animefan8888 said:

Where are they located?


Thats not the problem since saplings work with the same files. But they are located in resources/data/arcana/structures.. Oh wait thats not right


EDIT: It is right, Nevermind. But still, they dont spawn in the world. The saplings do work though

 

 

11 hours ago, Animefan8888 said:

You may want to set the chunk to the chunk you are in.You can get it from the IWorld parameter using the BlockPos parameter you were given.

Tried that, Doesnt change anything.

I got no errors in the console

Edited by Crack3dC0d3
Posted
10 hours ago, Crack3dC0d3 said:

But still, they dont spawn in the world. The saplings do work though

So then are the features getting called? Is the template returning null? Are you adding the feature to a biomes list of features?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
21 minutes ago, Crack3dC0d3 said:

Alright thanks, which parameters do i use? i got the first 2 but i dont understand the last 2

Biome#addFeature only has two parameters.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
24 minutes ago, Crack3dC0d3 said:

Sorry, wrong method. I meant Biome#createDecoratedFeature

I'm not sure to be honest look for where the trees are added in vanilla.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • 9 months later...
Posted (edited)
3 minutes ago, hohserg said:

Did anyone found how to port IWorldGenerator to Feature? I still wander in the dark. Help plz

Please start a new thread for your issue instead of posting in a nearly year old one, you'll get a better response :)

 

Also, include a description of what you are trying to do (from the gameplay standpoint; not HOW you want to do it), what you have tried (code is good, a github repo link is best), and logs (debug.log posted as a github gist is best)

Doing these things will ensure you get the best possible response. An incomplete post is an invitation to just have it skipped over!! ?

Edited by Ugdhar
  • Like 1
Posted
2 hours ago, hohserg said:

Did anyone found how to port IWorldGenerator to Feature? I still wander in the dark. Help plz

TLDR: you don't. You rewrite it from scratch.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

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.