Jump to content

[1.11.2] Custom Block Model Not Rendering


meee39
 Share

Recommended Posts

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 ] }
            }
        }
    ]
}

 

Link to comment
Share on other sites

  • 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.
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
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.

 Share



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • I figured out what was wrong ... you can spot it pretty quick most likely: { "type": "minecraft:smelting", "ingredient": { "item": "minecraft:gold_nugget_ore" }, "result": "minecraft:gold_nugget", "experience": 0.25, "cookingtime": 150 }   ... so, after changing `minecraft` to `foundations` for all the custom items and all the recipes work. Well that's what copy/paste will get you. One last question about recipes, though. What does the following json key/value do in the game? "group": "copper_ingot"  
    • # Copyright (c) 1993-2009 Microsoft Corp. # # This is a sample HOSTS file used by Microsoft TCP/IP for Windows. # # This file contains the mappings of IP addresses to host names. Each # entry should be kept on an individual line. The IP address should # be placed in the first column followed by the corresponding host name. # The IP address and the host name should be separated by at least one # space. # # Additionally, comments (such as these) may be inserted on individual # lines or following the machine name denoted by a '#' symbol. # # For example: # #      102.54.94.97     rhino.acme.com          # source server #       38.25.63.10     x.acme.com              # x client host # localhost name resolution is handled within DNS itself. #    127.0.0.1       localhost #    ::1             localhost ###0.0.0.0 apps.corel.com ###0.0.0.0 mc.corel.com 0.0.0.0 origin-mc.corel.com ###0.0.0.0 iws.corel.com
    • Is there a way to create a custom map marker for a custom structure/biome (same as a vanilla mansion)?
    • I’ve scrounged the Internet for solutions and found absolutely nothing that has worked for me I have posted my code in a GitHub Repository. I bet the culprit is somewhere in the Container or TileEntity classes (Furnace packages are in blocks/coke_furnace or blocks/foundry) PS I know I’m on 1.12.2 and that it’s not supported I don’t want to update my game or my code. Lol It’s my favorite version and the most widely modded. I don’t plan to release the mod, I’m just customizing my game to my will. I’ll send it to friends but that’s it.
    • 1.19.2 With forge 43.2.4   https://mclo.gs/zCAx1MG      
  • Topics

×
×
  • Create New...

Important Information

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