Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

crops 1.14


Guest
 Share

Recommended Posts

5 minutes ago, Animefan8888 said:

fillStateContainer is a method in the Block class. If you are having a hard time overriding the method you can press ctrl+space and type the method name to get suggestions.

my plants block class? or the block class. 

and also, I've tried pressing ctrl + space and typing fillStateContainer but nothing comes up along with "setAge" or "getAge" or "Age"

Link to comment
Share on other sites

  • Replies 98
  • Created
  • Last Reply

Top Posters In This Topic

1 minute ago, DrMDGG said:

or the block class. 

It exists in the Block class. You need to override it in your Block class I believe is called MPlant.

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.

Link to comment
Share on other sites

6 minutes ago, Animefan8888 said:

It exists in the Block class. You need to override it in your Block class I believe is called MPlant.

there's only two things that don't have an @Override already:

 

    public MPlant(Properties builder)
    {
        super(builder);
        this.setDefaultState(this.stateContainer.getBaseState().with(this.getAgeProperty(), Integer.valueOf(0)));
    }

_____________________________________________________________________________________________________________

and this one: 

 

 @OnlyIn(Dist.CLIENT)
    public ItemStack getItem(IBlockReader worldIn, BlockPos pos, BlockState state)
    {
       return new ItemStack(this.getSeedsItem());
    }

 

 

 

I assume its the first one?

 

 

edit: nevermind. its not the first one

Edited by Guest
Link to comment
Share on other sites

Just now, DrMDGG said:

I assume its the first one?

No. You don't know Java do you? First the @Override annotation doesn't actually do anything. It just lets you know that you are overriding a method from a parent class(hurray for inheritance). Secondly the method is a new one you have to add to your class. If it doesn't exist with the name fillStateContainer then it's likely that you are using an outdated version of forge. I'm only on 28.1.19

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.

Link to comment
Share on other sites

38 minutes ago, Animefan8888 said:

No. You don't know Java do you? First the @Override annotation doesn't actually do anything. It just lets you know that you are overriding a method from a parent class(hurray for inheritance). Secondly the method is a new one you have to add to your class. If it doesn't exist with the name fillStateContainer then it's likely that you are using an outdated version of forge. I'm only on 28.1.19

yeah. I updated forge, and low and behold, it came up.

https://github.com/drmdgg/marijuanacraft/blob/master/src/main/java/drmdgg/marijuanacraft/init/blocks/plants/MPlant.java

 

so I added that and changed getAge to getCropAge

 

what did I do wrong?

Link to comment
Share on other sites

2 minutes ago, DrMDGG said:

what did I do wrong?

I assume the same "error" is happening?

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.

Link to comment
Share on other sites

On 10/13/2019 at 9:11 AM, Animefan8888 said:

I assume the same "error" is happening?

is this error happening due to the lack of references to my plant seed not being in my seed class and the mplant class not referencing my mplant?

Link to comment
Share on other sites

You only need two references:

 

  1. The block instance is passed to the seed item's constructor
  2. The item instance is returned in the block's getSeedsItem method via a ModItems (ItemList) reference.

That's it.

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.

Link to comment
Share on other sites

4 minutes ago, Draco18s said:

You only need two references:

 

  1. The block instance is passed to the seed item's constructor
  2. The item instance is returned in the block's getSeedsItem method via a ModItems (ItemList) reference.

That's it.

okay, well it has all that...so what's the problem. at one point I get this in my runclient:

[16:51:03] [Server-Worker-2/WARN] [minecraft/ModelBakery]: Exception loading blockstate definition: 'marijuanacraft:blockstates/mplant.json' in resourcepack: 'main' for variant: 'age=5': Unknown blockstate property: 'age'

 

 

Link to comment
Share on other sites

56 minutes ago, DrMDGG said:

Exception loading blockstate definition: 'marijuanacraft:blockstates/mplant.json' in resourcepack: 'main' for variant: 'age=5': Unknown blockstate property: 'age'

For some reason it isnt recognizing that your block has an age property and when it is reading the blockstate json its seeing this and going "HUH?!?!"

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.

Link to comment
Share on other sites

3 minutes ago, Animefan8888 said:

For some reason it isnt recognizing that your block has an age property and when it is reading the blockstate json its seeing this and going "HUH?!?!"

any guesses on how to fix that? I've checked that json file and the others a billion times against the carrots and the wheat (which are obviously the same)

Link to comment
Share on other sites

4 minutes ago, DrMDGG said:

any guesses on how to fix that? I've checked that json file and the others a billion times against the carrots and the wheat (which are obviously the same)

The problem doesnt lie within the json. The problem lies within the code. Specifically why your block isnt getting the age property. Have you looked at the f3 screen while looking at your block to see if it has the age property on the right hand side of the screen?

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.

Link to comment
Share on other sites

10 minutes ago, Animefan8888 said:

The problem doesnt lie within the json. The problem lies within the code. Specifically why your block isnt getting the age property. Have you looked at the f3 screen while looking at your block to see if it has the age property on the right hand side of the screen?

it definitely does not

mcraftf3.png

Link to comment
Share on other sites

6 minutes ago, DrMDGG said:

it definitely does not

Double check that in your fillStateContainer method you add your age property to the Builder parameter.

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.

Link to comment
Share on other sites

15 minutes ago, Animefan8888 said:

Double check that in your fillStateContainer method you add your age property to the Builder parameter.

like this?

 

    @Override
    protected void fillStateContainer(Builder<Block, BlockState> builder) {
        
        builder.add(CROP_AGE);
        
        

Link to comment
Share on other sites

2 hours ago, Animefan8888 said:

Double check that in your fillStateContainer method you add your age property to the Builder parameter.

okay, so I triple...or maybe quadruple checked the cropsblock class and the code there is "builder.add(AGE);"

but if i'm extending CropsBlock then shouldn't all the age stuff be automatically added and unnecessary for me to add?

Link to comment
Share on other sites

1 minute ago, DrMDGG said:

but if i'm extending CropsBlock then shouldn't all the age stuff be automatically added and unnecessary for me to add?

Exactly make sure your fillStateContainer is being called though. I'm curious if something is broken.

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.

Link to comment
Share on other sites

12 hours ago, Animefan8888 said:

Exactly make sure your fillStateContainer is being called though. I'm curious if something is broken.

i also noticed that it will spawn on any block, not just farmland

Link to comment
Share on other sites

I suspect that the block being used by your seed item is not actually your crop block. But with the code you have, I'm not sure why that is.

My guess is that the item you're holding is not the one that we've been talking about, but another item entirely.

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.

Link to comment
Share on other sites

1 hour ago, Draco18s said:

I suspect that the block being used by your seed item is not actually your crop block. But with the code you have, I'm not sure why that is.

My guess is that the item you're holding is not the one that we've been talking about, but another item entirely.

I've gone through all my code. i must have missed something. 

 

you've seen my code in full. what item or block could possibly be doing this?

Link to comment
Share on other sites

58 minutes ago, DrMDGG said:

you've seen my code in full. what item or block could possibly be doing this?

*Shrug*

From my point of view, you created a bunch of stuff all at once (maybe copy-pasted from an old version?) without checking any of it to make sure it worked before going for more.

 

Always work on one block or item or system at a time, make sure its working 100%* before moving on to another.

 

*Sure, there are things that interleave sometimes, such as a crop and its seed, those can be worked on as a single operational group. And sometimes you need to break a thing down into smaller pieces and work on them and they won't be 100% until the larger structure is done, but you can handle that with placeholders and TODOs, but there you know what part isn't complete when you test it (for example, my ore system relies heavily on Custom Ore Gen and several ore generation events that don't exist, but that doesn't mean I can't make the blocks, items, loot tables, recipes, and enchantments, I just know I can't test the ore gen and prospecting systems until those events exist).

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.

Link to comment
Share on other sites

9 minutes ago, Draco18s said:

*Shrug*

From my point of view, you created a bunch of stuff all at once (maybe copy-pasted from an old version?) without checking any of it to make sure it worked before going for more.

 

Always work on one block or item or system at a time, make sure its working 100%* before moving on to another.

 

*Sure, there are things that interleave sometimes, such as a crop and its seed, those can be worked on as a single operational group. And sometimes you need to break a thing down into smaller pieces and work on them and they won't be 100% until the larger structure is done, but you can handle that with placeholders and TODOs, but there you know what part isn't complete when you test it (for example, my ore system relies heavily on Custom Ore Gen and several ore generation events that don't exist, but that doesn't mean I can't make the blocks, items, loot tables, recipes, and enchantments, I just know I can't test the ore gen and prospecting systems until those events exist). 

the original mod I made was for 1.8.9 so I couldn't copy anything.
but now everything is working order except for these damn crops thanks to you guys. I guess I'll just have to figure this out on my own if you can't help me further. thanks for the help. you'll be in my credits lol

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
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.

 Share




×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.