Jump to content

[1.10.2] Block is loading but not showing up


trentmartin2

Recommended Posts

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?

Link to comment
Share on other sites

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

}

}

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

In my ModBlocks class, or my GodBlock class?

When you register your Block register an ItemBlock.

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.

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.



×
×
  • Create New...

Important Information

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