Jump to content

Recommended Posts

Posted

Hello

I have created my own tulips to compleete a 16 colors set.

I can put them on the ground and into a flowerpot.

But how do i add them to s vanilla-biome?

 

I don´t know, where in that huge vanilla-code library i can find the matching code...

Posted

Use DeferredWorkQueue to add features to the biomes you want during the FMLCommonSetupEvent.

 

Check out classes in the net.minecraft.world.gen.feature package and the DefaultBiomeFeatures class in net.minecraft.world.biome.

Posted (edited)

Now i have this in my FMLCommonSetupEvent:

        DeferredWorkQueue.runLater(() ->
        {
            addModTulips(biomeIn);
        }
        );

But i´m not sure, how to put a specific biome into my method-call...

I don´t know, where the methods are called, wich i found in DefaultBiomeFeatures...

I must find this to see how a biome is given in there...

 

should i do it as a new instance of the biome-class?

Edited by Drachenbauer
Posted (edited)

now i found, what i looked for.

time for a test in a world with a flowerforest biome nearby.

 

Edit:

this is now my main-class:

  Reveal hidden contents

I made a method, that should ad my tulips to the flowerforest biome.

For a first test, it only includes the black tulip now.

 

But as i created a flower-forest-world, i cannot find any black tulips in there...

Edited by Drachenbauer
Posted (edited)
  Quote

This should be done in FMLClientSetupEvent, not common.

Expand  

some posts above, an user told me to work in common.

 

  Quote

The fact that the first line does not produce a NullPointerException suggests that you are also incorrectly initializing your blocks in a static initializer. You cannot do that. Please use DeferredRegister to register your Blocks.

Expand  

If i registered my blocks wrong, why i can place them in a world and plant the tulips in pots ?

Edited by Drachenbauer
Posted
  Quote

Yes, regarding adding the biome features...

Expand  

Do you mean the lines for making the tulips transparent should be in client?

I thaught, you mean my biome-thing.

 

  Reveal hidden contents

where else should i initialize them?

Posted

Now i register my blocks and items like shown in the sample in the "DeferredRegister"-class.

Can i remoce the integrated "RegistryEvents"-class from my main-class, if i finished the new way to register my stuff?

 

Can i put the lines for the single blocks and items, like:

    public static final RegistryObject<Block> BLACK_TULIP_BLOCK = BLOCKS.register("black_tulip", () -> new FlowerBlock(Effects.WEAKNESS, 9,
                        Block.Properties.create(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0f).sound(SoundType.PLANT)));

into my blocks- and items-classes, where i already had them listed?

Posted (edited)
  On 3/3/2020 at 4:37 PM, Drachenbauer said:

Can i remoce the integrated "RegistryEvents"-class from my main-class, if i finished the new way to register my stuff?

Expand  

Yes, but you need to register the modbus or something else in your main class (am writing from mobile and have forgot the name). If you still need help then pls provide a link to your Github

Edited by DragonITA

New in Modding? == Still learning!

Posted (edited)

Now i get an error:

  Reveal hidden contents

 

In the error i found a line, that says "Duplicate registration purple_tulip"

I wonder where this registration is duplicated...

 

This is now my main-class:

  Reveal hidden contents

Edit:

 

i think i found it now, saw, that the yellow tulip at the blocks registry had the registry name "purple_tulip".

fixed it now and test it

Edited by Drachenbauer
Posted (edited)

Now it works.

I created a new flower forest world and started directly in a patch of my own black tulips.

Now i just have to register the other tulips to biome the same way.

 

Edit:

Now i modifyed my Config-line for the biome, that it makes patches with a mix of all my tulip-colors.

 

Now i hace some more questions:

Where are the Blockstates from the vanilla-tulips?

I want to add them to my mixed tulip patches, too.

 

How can i make, that only my code adds tulips to the biomes?

Edited by Drachenbauer
Posted (edited)
private static final BlockState DANDELION = Blocks.DANDELION.getDefaultState();

I mean code-lines like this for the tulips.

This sample is the one for the dandelion and is located in the DefaultBiomeFeatures..

 

Or can i write my own into my code?

Now i´fe written my own lines of this.

 

How can i now make only my code generate tulips in the biomes?

 

I want to use my code for all biomes with tulips.

My idea is to use the set BIOMES in the class Biome and make a for-loop, that goes through the biomes:

for (Biome biome : Biome.BIOMES)
{

}

And inside therei want to check for tuips in the biomes and if yes, use my code..

For this i have a question

 

How can i check, if a biome has tulips?

Edited by Drachenbauer
Posted

Now i try this to check for tulips:

        DeferredWorkQueue.runLater(() ->
        {
            for (Biome biome : Biome.BIOMES)
            {
                /*if (biome.getFlowers().contains(o))
                {
                    
                }*/
                System.out.print(biome.getFlowers());
            }
            
            addModTulips(Biomes.FLOWER_FOREST);
        }
        );

At first i want to use an output to see, how the content of the flower-list looks.

But i find no result in the console...

Do i just not know, where in the console output i have to find output from the common-setup?

Or is there any reason, that this gives no output?

 

In another mod i used this output-command in a model-class and found it´s output in the console.

Posted
  On 3/3/2020 at 8:01 PM, Drachenbauer said:
private static final BlockState DANDELION = Blocks.DANDELION.getDefaultState();

I mean code-lines like this for the tulips.

This sample is the one for the dandelion and is located in the DefaultBiomeFeatures..

 

Or can i write my own into my code?

Now i´fe written my own lines of this.

 

How can i now make only my code generate tulips in the biomes?

 

I want to use my code for all biomes with tulips.

My idea is to use the set BIOMES in the class Biome and make a for-loop, that goes through the biomes:

for (Biome biome : Biome.BIOMES)
{

}

And inside therei want to check for tuips in the biomes and if yes, use my code..

For this i have a question

 

How can i check, if a biome has tulips?

Expand  

No, i think you should see the Json Blockstate.

New in Modding? == Still learning!

Posted (edited)

Now i have this:

 

        DeferredWorkQueue.runLater(() ->
        {
            System.out.println("Blumenliste:");
            
            for (Biome biome : Biome.BIOMES)
            {
                /*if (biome.getFlowers().contains(o))
                {
                    
                }*/
                
                System.out.println(biome);
                System.out.println(biome.getFlowers());
            }
            
            addModTulips(Biomes.FLOWER_FOREST);
            System.out.println("FLOWER_FOREST:");
            System.out.println(Biomes.FLOWER_FOREST);
            System.out.println(Biomes.FLOWER_FOREST.getFlowers());
        }
        );

 

and in the console i found this:

  Reveal hidden contents

This looks like Flower Forwst does not appear in the biomes-list...

and i still don´t know, what i should place intead of the "flower" in this code:

                if (biome.getFlowers().contains(flower))
                {
                    
                }

to check, if it for sample contains red tulips...

 

Edit:

in a Minecraft wiki, i saw, that tulips only appear in Plains, Sunflower Plains and Flower Forest.

Is this right?

 

If Yes, i simply can use 3 lines of my methode-call with theese biomes given as param.

Edited by Drachenbauer
Posted (edited)

I also think, biomes in mods may have the tulips added a bit different to the vanila-ones.

This can make it more difficult to check all biomes, that may appear in mods...

 

I also have a new question:

Can i have my block and item-registries separated into two init-classes?

In the vanila-code has a class Items, where all items are initialized.

And a class Blocks, where all blocks are initialized.

I have similar classes in my mod, too.

So i thaught, i can put the block-registrys into my blocks-class and the item-registrys in my items-class.

But now i get an error:

  Quote

java.lang.NullPointerException: Registry Object not present

Expand  

How can i make theese registrys work, if they are in separate classes?

 

Edit:

Now i found the solution:

Theese lines:

public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Reference.MOD_ID);

needed to be in the separate classes, too.

Edited by Drachenbauer
Posted (edited)

You answered, while i edited my post:

 

Now i found the solution:

Theese lines:

public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<>(ForgeRegistries.BLOCKS, Reference.MOD_ID);

and

public static final DeferredRegister<Item> ITEMS = new DeferredRegister<>(ForgeRegistries.ITEMS, Reference.MOD_ID);

needed to be in the separate classes, too.

 

Now it works.

Edited by Drachenbauer
Posted
  On 3/5/2020 at 1:37 PM, Drachenbauer said:

Another question:

 

how do i make bone meal spawn my tulips in theese biomes?

Expand  

Have you tried anything? Have you looked anywhere to see how vanilla stuff works?

I'd start with BoneMealItem and work back from there.

Posted
  On 3/5/2020 at 2:35 PM, Drachenbauer said:

I looked into that item, but saw nothing about the flower-blocks there...

Expand  

You can't give up so easy. Look at what happens when you use bonemeal, and follow the progression of code.

 

I did, and it lead me to notice it calls some methods from the IGrowable interface, which lead me to notice that when you bonemeal a block, the (IGrowable) block holds the code that is executed. That's as far as I got, I'll let you do the rest. :)

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.