Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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

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

}

 

  • Author

I've moved my recipes folder to this location as opposed to my assets folder. It's still not letting me craft it...

unknown.png

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

    }
}

 

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.

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.

  • Author

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.

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.

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.