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

My custom block model is not rendering. All it comes up as is the black and purple cube. There are two reasons that I know that it is not a problem with the model fle:

1. I created it with Mr. Crayfish's Model Creator and used an online JSON validator (it was valid).

2. It does not show up as invisible.

Code:

package com.leo.mobsuppressors.blocks;

import java.util.ArrayList;

import com.leo.mobsuppressors.EnumMobSuppressorType;
import com.leo.mobsuppressors.MobSuppressors;

import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraftforge.fml.common.registry.GameRegistry;

public class ModBlocks {
	public static Block enderSuppressor;
	public static Block creeperSuppressor;
	
	public static Block suppressionPedestal;
	
	public static void createBlocks() {
		enderSuppressor = new BlockMobSuppressor("endersuppressor", "endersuppressor", EnumMobSuppressorType.ENDER);
		creeperSuppressor = new BlockMobSuppressor("creepersuppressor", "creepersuppressor", EnumMobSuppressorType.CREEPER);
		suppressionPedestal = new BlockSuppressionPedestal("suppressionpedestal", "suppressionpedestal");
	}
	
	public static void init() {
		createBlocks();
		GameRegistry.register(enderSuppressor);
		GameRegistry.register(new ItemBlock(enderSuppressor).setRegistryName("endersuppressor"));
		
		GameRegistry.register(creeperSuppressor);
		GameRegistry.register(new ItemBlock(creeperSuppressor).setRegistryName("creepersuppressor"));
		
		GameRegistry.register(suppressionPedestal);
		GameRegistry.register(new ItemBlock(suppressionPedestal).setRegistryName("suppressionpedestal"));
	}
	
	public static void registerRenderers() {
		registerRenderer(enderSuppressor);
		registerRenderer(creeperSuppressor);
		
		registerRenderer(suppressionPedestal);
	}
	
	public static void registerRenderer(Block block) {
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(MobSuppressors.modid + ":" + block.getUnlocalizedName().substring(5), "inventory"));
	}
}
package com.leo.mobsuppressors.blocks;

import com.leo.mobsuppressors.CreativeTab;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;

public class BlockSuppressionPedestal extends Block {
	public BlockSuppressionPedestal(String unlocalizedName, String registryName) {
		super(Material.ROCK);
		
		this.setCreativeTab(CreativeTab.mobSuppressorCreativeTab);
		
		this.setUnlocalizedName(unlocalizedName);
		this.setRegistryName(registryName);
	}
	
	public BlockSuppressionPedestal(Material materialIn) {
		super(materialIn);
	}
}
{
    "forge_marker": 1,
    "variants": {
        "normal" {
	    "model": "mob:suppressors:suppressionpedestal"
	},
	"inventory": {
            "model": "mobsuppressors:suppressionpedestal", 
	    "transform": "forge:default-block"
        }
    }
}
{
    "__comment": "Model generated using MrCrayfish's Model Creator (http://mrcrayfish.com/modelcreator/)",
    "textures": {
        "particle": "blocks/suppressionpedestal_bottom",
        "0": "blocks/suppressionpedestal_bottom"
    },
    "elements": [
        {
            "name": "Cube",
            "from": [ 0.0, 0.0, 1.0 ], 
            "to": [ 16.0, 1.0, 16.0 ], 
            "faces": {
                "north": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
                "east": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
                "south": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
                "west": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
                "up": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
                "down": { "texture": "#0", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }
            }
        }
    ]
}

 

  • Post the latest log output, it will contain information about the errors.
Quote

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

 

  • This approach is very outdated.
    • Instead of Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register, you should use ModelLoader.setCustomModelResourceLocation.
    • You should not use getUnlocalizedName and that messy substring business to set model locations. Instead simply use getRegistryName, which also already includes your modid.
  • Where and when do you call your ModBlocks' init() and registerRenders() methods?
1 hour ago, meee39 said:

    "textures": {
        "particle": "blocks/suppressionpedestal_bottom",
        "0": "blocks/suppressionpedestal_bottom"
    },

 

  • These textures do not contain your modid, so by default forge will be looking for them in the minecraft folder.

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.