Jump to content

Recommended Posts

Posted

Hi there.

 

I'm exploring custom crops in modding and I thought I had things figured out but my crop never drops anything: no seeds, no custom crops no matter what the crop's age is.

 

I also tried changing the items in getSeed() and getCrop() to Items.WHEAT_SEEDS and Items.WHEAT respectively, just in case it was an issue with initialization of my custom items but it doesn't change anything.

 

Below is my code for the crop class, am I doing something wrong?

 

public class BlockCustomCropBottom extends BlockCrops {
	
	// Blocks's registry name
	private static final String REGISTRY_NAME = "custom_crop_bottom";
	// Blocks's unlocalized name
	private static final String UNLOCALIZED_NAME = TestMod.MOD_ID + "."
			+ REGISTRY_NAME;
	
	public BlockCustomCropBottom() {
		// Set registry and unlocalized name of the block
		this.setRegistryName(REGISTRY_NAME);
		this.setUnlocalizedName(UNLOCALIZED_NAME);
	}
	
	// Returns the seed belonging to this crop
	@Override
	protected Item getSeed() {
		System.out.println("\n\nSeeds\n");
		
		return Items.WHEAT_SEEDS;
	}
	
	// Returns the crop item gained when this crop is harvested
	@Override
	protected Item getCrop() {
		return Items.WHEAT;
	}
	
}

 

Thanks in advance.

Posted
11 minutes ago, LKloosterman said:

System.out.println("\n\nSeeds\n");

Does this ever get called?

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

Step through your code with the debugger, see where that method would normally get called. Find out the difference between stuff that works and your code

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 (edited)
23 minutes ago, Cadiboo said:

Step through your code with the debugger, see where that method would normally get called. Find out the difference between stuff that works and your code

About that, isn't the method called by MC/Forge when the plant is broken?

 

Edit: To clear things up, I'm not really sure where to put the breakpoints/check things out because if my function isn't even being called then it won't do much to put it there.

Edited by LKloosterman
Posted

The vanilla equivalent. Find out how it normally works

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

Please post the solution for people with same problem!

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)

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.