Jump to content

[1.10.2] Can't craft Modblock


Xerus

Recommended Posts

Likely not related, but You should be using

ModelLoader.setCustomModelResourceLocation

during the pre-initialization phase instead of using ItemModelMesher#register

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

Actually, what Draco18s said, is related, you are accessing the Minecraft#getMinecraft(), from what is quite likely your CommonProxy, or directly from your main, as you are also registering your block there, which means that you are calling the Client-side only Minecraft#getMinecraft(), on the Server-side.

 

Move the render-registration to your client-proxy, and do please use the Forge provided way of registration, than the Vanilla ItemModelMesher#register.

Also previously known as eAndPi.

"Pi, is there a station coming up where we can board your train of thought?" -Kronnn

Published Mods: Underworld

Handy links: Vic_'s Forge events Own WIP Tutorials.

Link to comment
Share on other sites

1. I made a new method in the Clientproxy to call this in the postinit:

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), 0, new ModelResourceLocation(""+b.getRegistryName()));

but the texture doesnt apply(it is getting called tho!)

 

2.JEI says this in the log:

 

[Client thread/ERROR] [JEI]: Found a broken recipe: net.minecraft.item.crafting.ShapedRecipes@5860fa7e

Output ItemStacks: Found an itemStack with a null item. This is an error from another mod.

Output Fluids: []

Input ItemStacks: [[1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xitem.hoeIron@0 minecraft:iron_hoe]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

]

 

Link to comment
Share on other sites

1. I made a new method in the Clientproxy to call this in the postinit:

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), 0, new ModelResourceLocation(""+b.getRegistryName()));

but the texture doesnt apply(it is getting called tho!)

ModelLoader

methods must be called in preInit, not postInit.

 

Use the

toString

method instead of concatenating the registry name with an empty string.

 

2.JEI says this in the log:

 

[Client thread/ERROR] [JEI]: Found a broken recipe: net.minecraft.item.crafting.ShapedRecipes@5860fa7e

Output ItemStacks: Found an itemStack with a null item. This is an error from another mod.

Output Fluids: []

Input ItemStacks: [[1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xitem.hoeIron@0 minecraft:iron_hoe]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

, [1xtile.stonebricksmooth@32767 minecraft:stonebrick]

]

 

You added a recipe that has an

ItemStack

with a

null

Item

as its output. This is probably because you added the recipe before you created and registered your items.

 

3. This isnt really related but how do I fix this:

A TileEntity type com.xerus.simpleautomation.blocks.TileEntityB has throw an exception trying to write state. It will not persist. Report this to the mod author

java.lang.RuntimeException: class com.xerus.simpleautomation.blocks.TileEntityB is missing a mapping! This is a bug!

You must register your

TileEntity

class with

GameRegistry.registerTileEntity

. Make sure you include your mod ID in the name you pass to this method.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Here are the relevant Codeparts:

 

registration class:

	static Container testblock = new Container();

public static void loadBlocks(){
	reg(testblock,"testblock");

	GameRegistry.registerTileEntity(ContainerTE.class, main.MODID);
}

public static void loadRecipes(){
	GameRegistry.addShapedRecipe(new ItemStack(testblock), "aaa", "aba", "aaa", 'a', Blocks.STONEBRICK, 'b', Items.IRON_HOE);
}

public static void reg(Block b,String name){
	b.setRegistryName(name);
	b.setUnlocalizedName(name);
	ItemBlock itemblock= new ItemBlock(b);
	itemblock.setRegistryName(name);
	GameRegistry.register(b);
	GameRegistry.register(itemblock);
	b.setCreativeTab(main.tab);
	main.proxy.regModel(b);
}

 

main class:

    @Instance(MODID)
    public static main instance;
    
    @SidedProxy(serverSide="com.xerus.simpleautomation.proxys.Commonproxy",clientSide="com.xerus.simpleautomation.proxys.Clientproxy")
    public static Commonproxy proxy = new Commonproxy();
    
    public static CreativeTabs tab = new CreativeTabs("saTab") {
	@Override
	public Item getTabIconItem() {
		return Item.getItemFromBlock(registration.testblock);
	}
};
    
    @EventHandler
    public void preInit(FMLInitializationEvent event){
    	registration.loadBlocks();
    }
    
    @EventHandler
    public void init(FMLInitializationEvent event){
    	NetworkRegistry.INSTANCE.registerGuiHandler(instance, new GuiHandler());
    	registration.loadRecipes();
    }
    
    @EventHandler
    public void postInit(FMLInitializationEvent event){
    }

 

Clientproxy:

	@Override
public void regModel(Object o){
	if(o instanceof Item){
		Item i=(Item)o;
		ModelLoader.setCustomModelResourceLocation(i, 0, new ModelResourceLocation(i.getRegistryName().toString()));
	} else if(o instanceof Block){
		Block b=(Block)o;
		ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(b), 0, new ModelResourceLocation(b.getRegistryName().toString()));
	} else {
		throw new IllegalArgumentException("Only Item and Block accepted");
	}
}

 

 

1. The Model still doesnt show (I now tested it with replacing the Modelloader line with Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(b), 0, new ModelResourceLocation(b.getRegistryName().toString())); and this does work)

 

2. As you can see in the code if I am not totally dumb the Item is registered before the recipe

Link to comment
Share on other sites

Your

preInit

,

init

and

postInit

methods all handle

FMLInitializationEvent

, so they're all called in init.

 

I would recommend moving your model registration to a dedicated client-only class rather than registering models as you register items/blocks.

 

Instead of reinventing method overloading with a series of

instanceof

checks, just use an actual overloaded method.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

DUDE THIS MISTAKE... :-X

Thanks!

Now it works!

 

Just wanted to ask: can't you call only the clientproxy if this is only clientside stuff? the current thing i've been told is that i have to make empty methods in the commonproxy and then override them

 

And my tile Entity drops black-purple particles why doesnt it automatically generate some from the block texture?

Link to comment
Share on other sites

Just wanted to ask: can't you call only the clientproxy if this is only clientside stuff? the current thing i've been told is that i have to make empty methods in the commonproxy and then override them

What you have now will work because you've used the proxy system properly, but it's not very flexible because it assumes that every

Item

uses the default model.

 

And my tile Entity drops black-purple particles why doesnt it automatically generate some from the block texture?

Block breaking particle textures are specified by the

"particle"

texture of the block model. Are you using a regular baked model specified by a blockstates file or are you using a

TileEntitySpecialRenderer

?

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

  • 3 weeks later...

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.

Announcements



×
×
  • Create New...

Important Information

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