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

I am running into a frustrating problem with block textures.  I can use the setBlockTextureName method or the IconRegister method, but the block in-game gets the purple/black placeholder.  The part that has me confused is that there is nothing in the console about "missing textures", which leads me to believe there's something sketchy in my code.  Keep in mind that the mod is loading and being recognized by Forge without any problems.

 

Here are the essentials:

 

@Mod(modid = "example", version = "1")
public class ExampleMod
{
   // public static final String MODID = "examplemod";
    public static final String VERSION = "1.0";
    
    @Instance(value = "example")
    public static ExampleMod instance;
    
    public static Block example;
    
    @SidedProxy(clientSide="com.example.examplemod.ClientProxy", serverSide="com.example.examplemod.CommonProxy")
    public static CommonProxy proxy;
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
    	example = new BlockExample().setBlockTextureName("example:Block1").setBlockName("example").setHardness(5F).setResistance(5F).setLightLevel(1F).setCreativeTab(CreativeTabs.tabBlock);
    	GameRegistry.registerBlock(example, "example");
    }
}

 

And BlockExample

public class BlockExample extends Block {

protected BlockExample() {
	super(Material.rock);
}

IIcon blockIcon;

@SideOnly(Side.CLIENT)
    public IIcon getIcon(int p_149691_1_, int p_149691_2_)
    {
	return blockIcon;
    }

@SideOnly(Side.CLIENT)
    public void registerBlockIcons(IIconRegister r)
    {
        this.blockIcon = r.registerIcon("example:Block1");
    }

}

  • Author

Register your blocks in preInit.

 

Thank you!  I could have sworn that I tried that already, but it worked regardless.

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.