Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.11.2] Block not being textured?


Recommended Posts

Hi!

 

So, I'm pretty new to modding so bare with me. I've created a block for testing purposes called "Town Centre". I've then created 3 json files: 1 under blockstates, 1 under models/block, and 1 under models/item. When I test it in game, I just see the un-textured block as the black/purple no texture thing.

 

Blockstates:

{
    "variants": {
        "normal": [
            { "model": "xmt:townCentre" }
     ]
    }
}

Models/Block:

{
    "parent": "block/cube_all",
    "textures": {
        "all": "xmt:blocks/townCentre"
    }
}

Models/Item:

{
    "parent": "block/cube_all",
    "textures": {
        "all": "xmt:blocks/townCentre"
     }
}

 

Here is my ModBlocks.java file:

https://pastebin.com/mXtaDZX2

 

Here is my BlocktownCentre.java file:

https://pastebin.com/sSqNraRy

 

Here is the full log from the Minecraft test run:

https://pastebin.com/8azSBBhP

 

Thanks for the help!

Edited by xXJamie_Xx
Link to post
Share on other sites
  • Replies 62
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

Do not use ItemModelMesher(Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register). It is outdated, causes bugs and obscure issues. The tutorial you saw that told you to use it is outdated. Use ModelLoader.

Blocks and items must be registered at least during pre-init. 

Models must be registered at least during pre-init. 

The best way would be to use forge's registry events to register your things.


Caused by: java.io.FileNotFoundException: xmt:blockstates/blocktowncentre.json

*looks at the screenshot posted*

xmt -> blockstates -> towncentre.json

Your blockstates file name does not match your registry name. Same goes for your itemblock as you are using the same registry name.

Edited by V0idWa1k3r
Link to post
Share on other sites
1 hour ago, V0idWa1k3r said:

Do not use ItemModelMesher. It is outdated, causes bugs and obscure issues. The tutorial you saw that told you to use it is outdated. Use ModelLoader.

Blocks and items must be registered at least during pre-init. 

Models must be registered at least during pre-init. 

The best way would be to use forge's registry events to register your things.

 


Caused by: java.io.FileNotFoundException: xmt:blockstates/blocktowncentre.json

*looks at the screenshot posted*

xmt -> blockstates -> towncentre.json

Your blockstates file name does not match your registry name. Same goes for your itemblock as you are using the same registry name.

Hi, I understand the second point you made, the tutorial was made back in January so things have obviously changed but would you be able to elaborate on that first point though?

Edited by xXJamie_Xx
Link to post
Share on other sites

Which part of it? :D

I am not sure at which stage you are registering your blocks/items as the method is called init, so I explicitly told you that you must at least register them at pre-init to avoid issues. You should really use forge's registry events(RegistryEvent.Register) - they are nicer and more understandable and guarantee that everything loads as needed. They are normal events that you can listen to using SubscribeEvent.

You are currently registering the model for your itemblock using ItemModelMesher(Minecraft.getMinecraft().getRenderItem().getItemModelMesher()). Do not. It is buggy and forge has an alternative called ModelLoader. Just call ModelLoader::setCustomModelResourceLocation. Does the same thing but without bugs or issues ;)

Edited by V0idWa1k3r
Link to post
Share on other sites
1 hour ago, V0idWa1k3r said:

Which part of it? :D

I am not sure at which stage you are registering your blocks/items as the method is called init, so I explicitly told you that you must at least register them at pre-init to avoid issues. You should really use forge's registry events(RegistryEvent.Register) - they are nicer and more understandable and guarantee that everything loads as needed. They are normal events that you can listen to using SubscribeEvent.

You are currently registering the model for your itemblock using ItemModelMesher(Minecraft.getMinecraft().getRenderItem().getItemModelMesher()). Do not. It is buggy and forge has an alternative called ModelLoader. Just call ModelLoader::setCustomModelResourceLocation. Does the same thing but without bugs or issues ;)

So if I understand you right, you are referring to this line:

Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));

You are saying just to replace that line with this:?

ModelLoader::setCustomModelResourceLocation

 

Link to post
Share on other sites

Well, not with that directly, that is just the way to write method names (classname::methodname) I usually use. Maybe something like

ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));

 

Link to post
Share on other sites
1 hour ago, V0idWa1k3r said:

Well, not with that directly, that is just the way to write method names (classname::methodname) I usually use. Maybe something like


ModelLoader.setCustomModelResourceLocation(Item.getItemFromBlock(block), 0, new ModelResourceLocation(block.getRegistryName(), "inventory"));

 

oh sorry, I wasn't thinking properly lol, I can see the difference, the previous piece of code made it so the untextured item was being shown in the middle of the screen and stuff so it was weird.  Also, the first point you brought up about which stage I was registering my blocks/items.

I already register them at pre-init with the following code:

	@EventHandler
	public void preInit(FMLPreInitializationEvent event)
	{
		ModItems.init();
		ModItems.register();
		
		ModBlocks.init();
		ModBlocks.register();
	}

 

Edited by xXJamie_Xx
Link to post
Share on other sites
1 hour ago, Jay Avery said:

All asset names must be completely lower case - names of blockstates files, models, and textures.

Was this a change in 1.11?  Because that's not true in 1.10.  Just want to know for when I update my mod to 1.11.

Link to post
Share on other sites
Just now, Malkierian said:

Was this a change in 1.11?  Because that's not true in 1.10.  Just want to know for when I update my mod to 1.11.

I think it was only enforced in 1.11+ (but was recommended before then).

Link to post
Share on other sites
1 hour ago, Malkierian said:

Was this a change in 1.11?  Because that's not true in 1.10.  Just want to know for when I update my mod to 1.11.

Although I cannot say for definite, I could almost be sure I heard another mod dev say that they had to do this for their mod so I believe this statement could be true.

Link to post
Share on other sites
1 hour ago, Jay Avery said:

I think it was only enforced in 1.11+ (but was recommended before then).

I still can't get the texture to load. I assume all the json files need to have "blocktowncentre" as the model/textures?

Link to post
Share on other sites
1 minute ago, xXJamie_Xx said:

I still can't get the texture to load. I assume all the json files need to have "blocktowncentre" as the model/textures?

Show your most up-to-date log and file structure. The names don't all have to be the same, they just have to be pointing to the correct resources. The blockstates file has to be the block's registry name, but the models it directs to can have any name - as long as there is a valid model file at that location. Similarly, the textures used in a model file can have any name, they just have to actually be there.

Link to post
Share on other sites
1 hour ago, V0idWa1k3r said:

Post your new log after you've made the changes.

 

1 hour ago, Jay Avery said:

Show your most up-to-date log and file structure. The names don't all have to be the same, they just have to be pointing to the correct resources. The blockstates file has to be the block's registry name, but the models it directs to can have any name - as long as there is a valid model file at that location. Similarly, the textures used in a model file can have any name, they just have to actually be there.

Latest Log: https://pastebin.com/8EpWjU7Z

File Structure: c6ZdL0h.png

Link to post
Share on other sites
Quote

Caused by: java.io.FileNotFoundException: xmt:models/item/blocktowncentre.json

This is the file it's looking for to get the item model. Do you have an item model file at this location? (Hint: you don't)

 

Quote

Caused by: java.io.FileNotFoundException: xmt:blockstates/blocktowncentre.json

This is the file it's looking for to get the blockstates. Do you have a blockstates file at this location? (Hint: you don't)

Link to post
Share on other sites
1 hour ago, Kokkie said:

You haven't changed the name...

In your blockstates folder change the name of towncentre.json to blocktowncentre.json and the same for your model.

 

1 hour ago, V0idWa1k3r said:

Caused by: java.io.FileNotFoundException: xmt:blockstates/blocktowncentre.json

Uh, you either needed to rename the asset name or your registry name, not both :D

Your registry name and asset name must match, as I've said.

 

1 hour ago, Jay Avery said:

This is the file it's looking for to get the item model. Do you have an item model file at this location? (Hint: you don't)

 

This is the file it's looking for to get the blockstates. Do you have a blockstates file at this location? (Hint: you don't)

I think the issue is that the json files are called towncentre.json instead of blocktowncentre.json.

Link to post
Share on other sites
1 hour ago, Jay Avery said:

Yes, I think so too. Maybe you could try changing the file names?

 

1 hour ago, Kokkie said:

Indeed it is...

I have changed the file names to "blocktowncentre.json", I have noticed that the texture now shows when the block is placed in the world but not in the players inventory. The latest log file or console do not show any errors.

Link to post
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.

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.




  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • I'm reworking vanilla enchanting mechanics for my mod, and need to completely replace the functionality of vanilla enchanting tables and anvils. I have 2 new tile entity blocks set up, and I'm working on their functionality at the moment. When they're done, how would I replace the vanilla blocks with them? Alternatively, how would I replace the tile entity of the vanilla blocks with my own tile entities?
    • This is the crash report  Description: Initializing game java.lang.NoClassDefFoundError: slimeknights/tconstruct/library/client/MaterialRenderInfo     at lucraft.mods.lucraftcore.LCConfig$Materials.<init>(LCConfig.java:108)     at lucraft.mods.lucraftcore.LCConfig.<clinit>(LCConfig.java:36)     at lucraft.mods.lucraftcore.addonpacks.AddonPackHandler.getAddonPacksDir(AddonPackHandler.java:61)     at lucraft.mods.lucraftcore.core.LCClientHooks.insertAddonPackResourcePacks(LCClientHooks.java:37)     at net.minecraft.client.Minecraft.func_110436_a(Minecraft.java:789)     at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:247)     at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:467)     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)     at net.minecraft.client.main.Main.main(SourceFile:123)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28) Caused by: java.lang.ClassNotFoundException: slimeknights.tconstruct.library.client.MaterialRenderInfo     at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:191)     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)     at java.lang.ClassLoader.loadClass(ClassLoader.java:357)     ... 15 more Caused by: java.lang.NullPointerException A detailed walkthrough of the error, its code path and all known details is as follows: --------------------------------------------------------------------------------------- -- Head -- Thread: Client thread Stacktrace:     at lucraft.mods.lucraftcore.LCConfig$Materials.<init>(LCConfig.java:108)     at lucraft.mods.lucraftcore.LCConfig.<clinit>(LCConfig.java:36)     at lucraft.mods.lucraftcore.addonpacks.AddonPackHandler.getAddonPacksDir(AddonPackHandler.java:61)     at lucraft.mods.lucraftcore.core.LCClientHooks.insertAddonPackResourcePacks(LCClientHooks.java:37)     at net.minecraft.client.Minecraft.func_110436_a(Minecraft.java:789)     at net.minecraftforge.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:247)     at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:467) -- Initialization -- Details: Stacktrace:     at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:378)     at net.minecraft.client.main.Main.main(SourceFile:123)     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)     at java.lang.reflect.Method.invoke(Method.java:497)     at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)     at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
    • So I started my mods and this error popped up  The game crashed whilst initializing game Error: java.lang.NoClassDefFoundError: slimeknights/tconstruct/library/client/MaterialRenderInfo Exit Code: -1 which is weird since I don't have tinkers construct installed or is that something else and how do I fix this.
    • I want to use an old mod for some reason, but the forge-1.12.2-14.23.4.2764 installer does not work with the following error. java.net.preferIPv4Stack=true Exception in thread "main" java.lang.reflect.InvocationTargetException     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)     at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)     at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)     at java.lang.reflect.Method.invoke(Unknown Source)     at net.minecraftforge.installer.Java6Gate.main(Java6Gate.java:48) Caused by: java.lang.ExceptionInInitializerError     at net.minecraftforge.installer.ClientInstall.getSponsorMessage(ClientInstall.java:401)     at net.minecraftforge.installer.InstallerAction.getSponsorMessage(InstallerAction.java:60)     at net.minecraftforge.installer.InstallerPanel.updateFilePath(InstallerPanel.java:334)     at net.minecraftforge.installer.InstallerPanel.<init>(InstallerPanel.java:315)     at net.minecraftforge.installer.SimpleInstaller.launchGui(SimpleInstaller.java:167)     at net.minecraftforge.installer.SimpleInstaller.main(SimpleInstaller.java:54)     ... 5 more Caused by: java.lang.ArrayIndexOutOfBoundsException: 1     at net.minecraftforge.installer.MirrorData.buildMirrorList(MirrorData.java:84)     at net.minecraftforge.installer.MirrorData.<init>(MirrorData.java:63)     at net.minecraftforge.installer.MirrorData.<clinit>(MirrorData.java:17)     ... 11 more Is there a way to install this version other than the installer? The method of copying and overwriting the version of the .minecraft folder according to the explanation site on the net did not work. I don't want such an answer [1.12 is no longer supported on this forum. Please update to a modern version of Minecraft to receive support.]
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.