LKloosterman Posted March 12, 2019 Posted March 12, 2019 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. Quote
Cadiboo Posted March 12, 2019 Posted March 12, 2019 11 minutes ago, LKloosterman said: System.out.println("\n\nSeeds\n"); Does this ever get called? Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
LKloosterman Posted March 12, 2019 Author Posted March 12, 2019 1 minute ago, Cadiboo said: Does this ever get called? Nope, I used it to check but it never gets printed, which means to me that the function itself isn't used which is... strange. Quote
LKloosterman Posted March 13, 2019 Author Posted March 13, 2019 Is there any more information I can provide? I've been trying to figure this out for like an hour aha. Quote
Cadiboo Posted March 13, 2019 Posted March 13, 2019 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 Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
LKloosterman Posted March 13, 2019 Author Posted March 13, 2019 (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 March 13, 2019 by LKloosterman Quote
Cadiboo Posted March 13, 2019 Posted March 13, 2019 The vanilla equivalent. Find out how it normally works Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
LKloosterman Posted March 13, 2019 Author Posted March 13, 2019 So, we can go ahead and close or remove this thread, it turns out the "issue" had nothing to do with Forge or modding, and mostly just my stupidity... Quote
Cadiboo Posted March 13, 2019 Posted March 13, 2019 Please post the solution for people with same problem! Quote About Me Spoiler My Discord - Cadiboo#8887 My Website - Cadiboo.github.io My Mods - Cadiboo.github.io/projects My Tutorials - Cadiboo.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)
LKloosterman Posted March 13, 2019 Author Posted March 13, 2019 The solution? Make sure you're in survival mode. ? I was in Creative mode for testing and forgot to switch over to survival mode which means no drops when destroying blocks! Quote
Recommended Posts
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.