Jump to content

Recommended Posts

Posted

In 1.12.2 i had it working to where my custom food, example is Corn, When planted would drop both Corn, and sometimes drop a seed so you can re-plant the crop and keep it going. In 1.13.2, I looked at the code for Wheat Seeds and pretty much followed the same setup they have, but my corn continues to only drop food, never any seeds. Here is my Corn Crop code, as well as the Corn Seed Code.

 

Corn Crop Class- https://pastebin.com/yMjhsXaR

Corn Seed Class- https://pastebin.com/JEUSUmLE

Where I am creating the Corn Crop- https://pastebin.com/TmcUHEXJ

Where I am Creating the Corn Seed- https://pastebin.com/FA3zzeBg

 

Not sure what im doing wrong, or if I missed anything, any help would be appreciated. Also I noticed that when I break a crop before its fully grown, nothing at all drops, which was not the case in 1.12.2. Anyone know why this is from looking at my code ?

Posted (edited)

1. Stop using static initializers.

2. Most of your overriding methods does not have the @Override annotation, and are therefore messy and hard to debug. Use the @Override notation.

I suspect that you did not override some necessary methods due to the wrong signature. After adding the Override annotations to all of your methods, your compiler should tell you what the problem is.

Edited by DavidM

Some tips:

Spoiler

Modder Support:

Spoiler

1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code.

2. Always post your code.

3. Never copy and paste code. You won't learn anything from doing that.

4. 

Quote

Programming via Eclipse's hotfixes will get you nowhere

5. Learn to use your IDE, especially the debugger.

6.

Quote

The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it.

Support & Bug Reports:

Spoiler

1. Read the EAQ before asking for help. Remember to provide the appropriate log(s).

2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support.

 

 

Posted
1 hour ago, DavidM said:

1. Stop using static initializers.

What: Not using static initialisers.
Why: Using static initialisers does not allow you to control when your objects are created or the order in which your objects are created.
Consequences: Using static initialisers prevents other mods from overriding your objects, prevents forge from being able to dynamically load/unload mods and can cause weird, unreproducible crashes.
How: Use the @ObjectHolder annotation if you need static references to your objects and create & register your objects in the appropriate registry event. (Note: before registry events Modders created and registered their items in preInit. This practice became out of date in 1.7 with the introduction of registry events, and is no longer possible in 1.13).

1 hour ago, DavidM said:

2. Use the @Override notation

What: Using @Override.
Why: Using @Override tells the compiler that you intend to override a method. This lets your IDE warn you about bugs before they happen.
Consequences: When you update your mod to a new minecraft version/ update your mappings/ update your Forge version and don’t use @Override, methods will silently stop overriding what they should override due to name changes, and will fail to ever be called, resulting in unexpected behaviour, crashes and bugs.
How: Just annotate methods you intend to override with the @Override annotation.

 

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
7 hours ago, Cadiboo said:

What: Not using static initialisers.
Why: Using static initialisers does not allow you to control when your objects are created or the order in which your objects are created.
Consequences: Using static initialisers prevents other mods from overriding your objects, prevents forge from being able to dynamically load/unload mods and can cause weird, unreproducible crashes.
How: Use the @ObjectHolder annotation if you need static references to your objects and create & register your objects in the appropriate registry event. (Note: before registry events Modders created and registered their items in preInit. This practice became out of date in 1.7 with the introduction of registry events, and is no longer possible in 1.13).

What: Using @Override.
Why: Using @Override tells the compiler that you intend to override a method. This lets your IDE warn you about bugs before they happen.
Consequences: When you update your mod to a new minecraft version/ update your mappings/ update your Forge version and don’t use @Override, methods will silently stop overriding what they should override due to name changes, and will fail to ever be called, resulting in unexpected behaviour, crashes and bugs.
How: Just annotate methods you intend to override with the @Override annotation.

 

 

Your most recent few posts with these pre-written snippets of advice have been poorly formatted on the dark theme:

 

image.thumb.png.4beb7a8f3da8f5f0f3ee10e521e3e593.png

 

To fix it, you should be able to use the Tx (Remove Format) button and then re-apply the code formatting to the necessary parts.

 

Normally I'd PM you this, but unfortunately the forum wants me to delete a whole lot of PMs in my inbox before I can send another one.

  • Thanks 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

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.