Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Help with crafting!


PixxiBunny
 Share

Recommended Posts

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!!

unknown.png

Link to comment
Share on other sites

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());
        }
    };

}

 

Link to comment
Share on other sites

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));

    }
}

 

Link to comment
Share on other sites

I've created a loot_tables package. Here's what I have:

unknown.png

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.

Link to comment
Share on other sites

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
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.

 Share



×
×
  • Create New...

Important Information

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