Jump to content

LKloosterman

Members
  • Posts

    24
  • Joined

  • Last visited

Everything posted by LKloosterman

  1. 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!
  2. 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...
  3. 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.
  4. Is there any more information I can provide? I've been trying to figure this out for like an hour aha.
  5. 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.
  6. 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.
  7. For now I'm going to sleep, but tomorrow I will try out TheMasterGabriel and Draco18s's idea with the custom IRecipe class. Thanks everyone, will update tomorrow. (I hate unfinished/solved forum topics when I'm searching for a solution to a problem...)
  8. Forgive me if I'm wrong, but would that not be the same as doing GameRegistry.addShapelessRecipe(new ItemStack(ModItems.silver_coin), ModItems.copper_coin, ModItems.copper_coin, ModItems.copper_coin, ModItems.copper_coin, ModItems.copper_coin); Just trying to wrap my head around what you did.
  9. No problem, thanks for trying to help in any case. I guess I can serve as some faith restored to you for people asking questions on here.
  10. Thanks, this is the type of answer I can use. And I am well-versed in Java, I just didn't know about the listing quirk. Thanks.
  11. Yeah, I know that, obviously I took the quotations out and put GameRegistry.addShapelessRecipe(new ItemStack(ModItems.copper_coin, 5), new ItemStack(ModItems.silver_coin)); I didn't just copy what you wrote I know a moderate amount of Java, I've taken two HS Computer Science Courses and going to college for Software Development in 3 days, on top of this I've made several Java applications and mods before. I'm using Eclipse.
  12. Nope, as mentioned before, the Silver Coin works perfectly, it's the copper coin that's the problem.
  13. I add the Recipes in my ModRecipes Class: package com.currencymod.init; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModRecipes { public static void registerRecipes() { addCraftingRecipes(); } private static void addCraftingRecipes() { //Shapeless recipes GameRegistry.addShapelessRecipe(new ItemStack(ModItems.copper_coin, 5), ModItems.silver_coin); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.silver_coin, 1), new ItemStack(ModItems.copper_coin, 5)); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.silver_coin , 5), ModItems.gold_coin); GameRegistry.addShapelessRecipe(new ItemStack(ModItems.gold_coin), new ItemStack(ModItems.silver_coin, 5)); } } And I initialize the items in my ModItems class: package com.currencymod.init; import com.currencymod.item.ItemCurrency; import net.minecraft.item.Item; import net.minecraftforge.fml.common.registry.GameRegistry; public class ModItems { //Items public static ItemCurrency copper_coin; public static ItemCurrency silver_coin; public static ItemCurrency gold_coin; static { copper_coin = registerItem(new ItemCurrency("copper_coin")); silver_coin = registerItem(new ItemCurrency("silver_coin")); gold_coin = registerItem(new ItemCurrency("gold_coin")); } private static <T extends Item> T registerItem(T item) { GameRegistry.register(item); return item; } } And here's my Main class, although I don't think it'll be too helpful: package com.currencymod.main; import com.currencymod.proxy.CommonProxy; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod.EventHandler; import net.minecraftforge.fml.common.Mod.Instance; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @Mod(modid = Main.MOD_ID, name = Main.MOD_NAME, version = Main.MOD_VERSION) public class Main { public static final String MOD_ID = "currencymod"; public static final String MOD_NAME = "Lars's Currency Mod"; public static final String MOD_VERSION = "1.0.0"; @SidedProxy(clientSide = "com.currencymod.proxy.ClientProxy", serverSide = "com.currencymod.proxy.ServerProxy") public static CommonProxy proxy; @Instance(MOD_ID) public static Main instance; @EventHandler public void preInit(FMLPreInitializationEvent event) { proxy.preInit(event); } @EventHandler public void init(FMLInitializationEvent event) { proxy.init(event); } @EventHandler public void postInit(FMLPostInitializationEvent event) { proxy.postInit(event); } }
  14. I just made 1 Copper Coin output 1 Gray Dye and now it works. I guess it'll work for now, it's only a simple mod anyway.
  15. I'm thinking it's because the crafting recipe for 1 Silver Coin is made but not for one copper... So I need to make a recipe for 1 Copper Coin that outputs nothing or something so that it will work properly...
  16. Yessir. That's why I'm confused When I take away GameRegistry.addShapelessRecipe(new ItemStack(ModItems.copper_coin, 5), ModItems.silver_coin); The Silver Coins do the exact same thing as the Copper
  17. The Silver Coins work as I expected, when I add one it outputs a Copper Coin, same for if I put in 2, 3, and 4 in a stack, and then when I add a fifth to the stack and put it in the crafting table, the stack of 5 Silver Coins outputs one Gold Coin. It's just the Copper Coin that isn't working.
  18. The one part that continues to baffle me is that it works for the silver coins without problem, until I remove GameRegistry.addShapelessRecipe(new ItemStack(ModItems.silver_coin, 1), new ItemStack(ModItems.copper_coin, 5));
  19. I tried that but what happens is the 5 coins then need to be spread out in the crafting area, instead of being able to be used in a stack of 5. This way, it can be used in the player's inventory.
  20. Alright, so I host a small server which a couple of friends and I play on pretty much every night, and during one of our sessions, we thought up that it would be cool if we had some sort of currency system as we have sort of a town-type game with a lot of bartering. Being a pretty experienced modder, I decided I'd just make a super simple currency mod, but it turns out, even the simplest of mods gives me trouble. I added three items, those being copper, silver, and gold coins. I decided on making simple shapeless crafting recipes in order to switch between them, here's what I have: //1 Silver Coin -> 5 Copper Coins GameRegistry.addShapelessRecipe(new ItemStack(ModItems.copper_coin, 5), ModItems.silver_coin); //5 Copper Coins -> 1 Silver Coin GameRegistry.addShapelessRecipe(new ItemStack(ModItems.silver_coin, 1), new ItemStack(ModItems.copper_coin, 5)); //1 Gold Coin -> 5 Silver Coins GameRegistry.addShapelessRecipe(new ItemStack(ModItems.silver_coin , 5), ModItems.gold_coin); //5 Silver Coins -> 1 Gold Coin GameRegistry.addShapelessRecipe(new ItemStack(ModItems.gold_coin), new ItemStack(ModItems.silver_coin, 5)); As you can see, my plan was to have 5 Copper Coins be equal to 1 Silver Coin, 5 Silver Coins to 1 Gold Coin, and then be able to reverse this by using 1 Gold Coin to equal 5 Silver Coins, and 1 Silver Coin to equal 1 Copper Coins. This seemed fine to me and I tested it, and actually almost released it but for one bug. When I place 1 Copper Coin in the crafting area, it outputs 1 Silver coin. If I change the line: GameRegistry.addShapelessRecipe(new ItemStack(ModItems.silver_coin, 1), new ItemStack(ModItems.copper_coin, 5)); to: GameRegistry.addShapelessRecipe(new ItemStack(ModItems.silver_coin, 5), new ItemStack(ModItems.copper_coin, 5)); inserting 1 Copper Coin outputs 5 Silver coins, even though I told the recipe to use 5 Copper Coins. Now comes the weird part... if I place 1 Silver Coin it does not output 1 Gold Coin like I thought it would, that only happens if I take out this part: GameRegistry.addShapelessRecipe(new ItemStack(ModItems.copper_coin, 5), ModItems.silver_coin); I searched Google for information on how the ShaplessRecipes method works, and even looked at the ItemStack class to see if I was using the ItemStack(ItemIn, amount) method wrong but I couldn't see anything that would explain this... Let me know what I might be doing wrong, I'm here to learn.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.