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

Hello,

I got back into modding and started from scratch today. So my question might be very stupid but bear with me.

To get a feeling for forge i wanted to add a simple item and a simple block (plus blockitem) via DeferredRegistry.
The item and the blockitem render fine, but the placed block neither renders correctly nor does it drop the item.

I added a screenshot of the game.

Thank you for your help.

Here is the code that registers blocks and items:

 

public class Blocks {
    public static final DeferredRegister<Block> BLOCKS = new DeferredRegister<Block>(ForgeRegistries.BLOCKS, Constants.MODID);

    //Simple Blocks
    public static final RegistryObject<Block> CORRUPTED_BRICK = BLOCKS.register("corrupted_brick", () -> new Block(Block.Properties.create(Material.ROCK).hardnessAndResistance(6f,1.5f).harvestTool(ToolType.PICKAXE).harvestLevel(1).sound(SoundType.STONE)));
    //Complex Blocks

    public static void registerBlocks(){
        BLOCKS.register(FMLJavaModLoadingContext.get().getModEventBus());
    }
}

public class Items {
    public static final DeferredRegister<Item> ITEMS = new DeferredRegister<Item>(ForgeRegistries.ITEMS, Constants.MODID);

    //BlockItem
    public static final RegistryObject<Item> CORRUPTED_BRICK = register("corrupted_brick", Blocks.CORRUPTED_BRICK);
    //Simple Item
    public static final RegistryObject<Item> CORRUPTED_DIAMOND = ITEMS.register("corrupted_diamond", () -> new Item( new Item.Properties().group(Constants.GROUP)));
    //Complex Item

    public static void registerItems(){
        ITEMS.register(FMLJavaModLoadingContext.get().getModEventBus());
    }

    private static RegistryObject register(String name, RegistryObject<Block> block){
        return ITEMS.register(name, () -> new BlockItem(block.get(), new Item.Properties().group(Constants.GROUP)));
    }
}

@Mod(Constants.MODID)
public class CallOfTheVoid {
    public CallOfTheVoid(){
        Blocks.registerBlocks();
        Items.registerItems();
    }
}

 

2020-06-01_16.52.19.png

EDIT: I forgot to add the Blockstates json file

Edited by Mii1128

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.