Jump to content

[SOLVED] Blocks not rendering in world but in Inventory


Mii1128

Recommended Posts

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
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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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.

Announcements



×
×
  • Create New...

Important Information

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