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

When I load minecraft with any block, It doesn't show up in the creative tabs AND it doesn't work when I type the command "/give (player) mt:(block registry name)". I can tell that it loads because when I comment the code for the block and load the world, it tells me that the block is missing. WTF?

  • Author

For the creative tab you have to set it using Block#setCreativeTab(creativeTab)

 

It also doesn't show up using commands... I'm pretty sure the creative tab code is okay.

  • Author

Main:

package com.trentmartin2.mt;

 

import com.trentmartin2.mt.proxy.ClientProxy;

import com.trentmartin2.mt.proxy.CommonProxy;

 

import net.minecraftforge.fml.common.Mod;

import net.minecraftforge.fml.common.Mod.EventHandler;

import net.minecraftforge.fml.common.Mod.Instance;

import net.minecraftforge.fml.common.SidedProxy;

import net.minecraftforge.fml.common.event.FMLInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;

import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

 

@Mod(modid = Main.MODID, version = Main.VERSION)

public class Main

{

    public static final String MODID = "mt";

    public static final String VERSION = "Beta-1.0";

   

    @Instance

    public static Main instance;

 

    @SidedProxy(clientSide = "com.trentmartin2.mt.proxy.ClientProxy", serverSide = "com.trentmartin2.mt.proxy.ServerProxy")

    public static CommonProxy proxy;

   

    @EventHandler

    public void preInit(FMLPreInitializationEvent event)

    {

    System.out.println("Pre Initialization");

    ModItems.init();

    ModItems.register();

    ModBlocks.init();

    ModBlocks.register();

    }

   

    @EventHandler

    public void init(FMLInitializationEvent event)

    {

    System.out.println("Initialization");

        proxy.init();

        ModCrafting.recipes();

    }

   

    @EventHandler

    public void postInit(FMLPostInitializationEvent event)

    {

   

}

}

 

 

ModBlocks:

package com.trentmartin2.mt;

 

import com.trentmartin2.mt.blocks.GodBlock;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.Minecraft;

import net.minecraft.client.renderer.block.model.ModelResourceLocation;

import net.minecraft.item.Item;

import net.minecraftforge.fml.common.registry.GameRegistry;

 

public class ModBlocks

{

public static Block godblock;

 

public static void init()

{

godblock = new GodBlock();

}

 

public static void register()

{

GameRegistry.register(godblock);

}

 

public static void registerRenders()

{

registerRender(godblock);

}

 

public static void registerRender(Block block)

{

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(Main.MODID + ":" + block.getUnlocalizedName().substring(5), "inventory"));

}

}

 

GodBlock:

package com.trentmartin2.mt.blocks;

 

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.creativetab.CreativeTabs;

 

public class GodBlock extends Block

{

public GodBlock()

{

super(Material.ROCK);

this.setUnlocalizedName("godblock");

this.setRegistryName("godblock");

this.setCreativeTab(CreativeTabs.BUILDING_BLOCKS);

}

}

  • Author

You are not registering an ItemBlock for your block. This means it can only exist placed down in the world, not in any inventory or as an item entity.

 

how do I fix this?

 

When you register your Block register an ItemBlock like so. GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

  • Author

When you register your Block register an ItemBlock like so. GameRegistry.register(new ItemBlock(block).setRegistryName(block.getRegistryName()));

 

In my ModBlocks class, or my GodBlock class?

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.