Posted April 30, 20205 yr Alright, so I'm very new to coding and modding. I'm trying to create a crafting recipe of a block, but it just doesn't work. I'm trying to follow as many YouTube tutorials as possible, but they're just all over the place! I'm probably missing a whole chunk of code or something. Again, I'm very new to this, so any help is appreciated!!
April 30, 20205 yr Screenshots are a terrible way to share code, btw use code blocks, or even better a github repo of your project. Google up on it, github is pretty easy!! What version is this for?
April 30, 20205 yr Author Yes lol. Its just a placeholder for now. Here's my main mod class: package com.pixxibunny.minecraftmod; import com.pixxibunny.minecraftmod.util.RegistryHandler; import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @Mod("modid") public class MinecraftMod { private static final Logger LOGGER = LogManager.getLogger(); public static final String MOD_ID = "modid"; public MinecraftMod() { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::setup); FMLJavaModLoadingContext.get().getModEventBus().addListener(this::doClientStuff); RegistryHandler.init(); MinecraftForge.EVENT_BUS.register(this); } private void setup(final FMLCommonSetupEvent event) { } private void doClientStuff(final FMLClientSetupEvent event) { } public static final ItemGroup TAB = new ItemGroup("modTab") { @Override public ItemStack createIcon() {return new ItemStack(RegistryHandler.ROSE.get()); } }; }
April 30, 20205 yr Your recipe needs to be in data.modid.recipes assets is only for client stuff, models, textures, etc
April 30, 20205 yr Author I've moved my recipes folder to this location as opposed to my assets folder. It's still not letting me craft it...
April 30, 20205 yr No no, I mean in your resources, make a new package data.modid.recipes it'll be alongside your assets package
April 30, 20205 yr Author Wow! That worked! Thank you so much! One last problem, I hope you don't mind... I have it so that the block can be broken with an iron pick but it doesn't drop in any instance when harvested. Any ideas? Here is my RoseBlock class: package com.pixxibunny.minecraftmod.blocks; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraftforge.common.ToolType; public class RoseBlock extends Block { public RoseBlock() { super(Block.Properties.create(Material.IRON) .hardnessAndResistance(5.0f,6.0f) .sound(SoundType.METAL) .harvestLevel(2) .harvestTool(ToolType.PICKAXE)); } }
April 30, 20205 yr Do you have a loot_table setup for your block in src/main/resources/data/minecraftmod/loot_tables?
April 30, 20205 yr 1 minute ago, PixxiBunny said: Ah, no, I don't. How would I go about setting that up? Same as you did for recipes. Create the package, then add the block you want to drop.
April 30, 20205 yr You can view what minecraft does but, I'm not familiar with IntelliJ and were to look for it though. There should be a Reference Library you can peruse through for the source code of minecraft.
April 30, 20205 yr Author I've created a loot_tables package. Here's what I have: Here is the code within the loot_tables.blocks for the rose_crystal_block.json: { "type": "minecraft:crafting_shaped", "pattern": [ "RRR", "RRR", "RRR" ], "key": { "R": { "item": "modid:rose_crystal_thing" } }, "result": { "item": "modid:rose_crystal_block", "count": 1 } } This is the exact same thing I have in the recipe json. I had no idea what to do lol.
April 30, 20205 yr No, the recipe does not go in the loot_table. Just the block you want to drop. Spoiler { "type": "minecraft:block", "pools": [ { "rolls": 1, "entries": [ { "type": "minecraft:item", "name": "minecraftmod:rose_crystal_block" } ] } ] }
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.