Jump to content

[1.10] Custom ItemBlock class?


Draco18s

Recommended Posts

I found this thread, but there isn't enough information to be sure I've done things correctly.

 

Assuming my ItemBlock class is

ItemOreBlock extends ItemBlock

:

 

  • What is the name of the json file?
  • Where is the json file supposed to be located?
  • How to I register my block?

 

Because nothing I've tried works.

 

Current:

		oreIron = new BlockHardOreBase();
	oreIron.setRegistryName("hardiron");
	oreIron.setUnlocalizedName(oreIron.getRegistryName().toString());
	ItemBlock ib = new ItemOreBlock(oreIron);
	ib.setRegistryName("hardiron");
	GameRegistry.register(oreIron);
	GameRegistry.register(ib);

 

Which gives me flat, 2D "missing texture" items.

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

You don't register a model for the

Item

in that code snippet, so Minecraft doesn't give it one.

 

You must call

ModelLoader.setCustomModelResourceLocation

(for metadata to

ModelResourceLocation

mapping) or

ModelLoader.setCustomMeshDefinition

(for arbitrary

ItemStack

to

ModelResourceLocation

mapping). If you use the latter, you must also tell Minecraft to load all possible

ModelResourceLocation

s returned by the

ItemMeshDefinition

by calling

ModelBakery.registerItemVariants

; the former does this for you. All of this must be done in preInit from your client proxy (or a class called from it).

 

I have an explanation of the model loading process and how

ModelResourceLocation

s are mapped to models here.

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

Ah, need to set the custom model location for the item too.  Of course.

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

I see.  Ok then.

 

Next question:

Do I seriously need to have a separate JSON file for every item model variant? I'm going to have 16 variants for one block and I'm going to easily end up with 11 of these blocks (iron, gold, diamond, copper, tin, aluminum, lead, nickel, osmium, silver, uranium).

 

For blocks this was easy: 1 base model file and 1 blockstate file declaring the 16 variants (each variant changing a single texture).

For items it looks like I need a whole file just to declare that texture.

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

Then I am not understanding how to specify the variant.

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

Can't figure out how to point it at the existing BlockState json, but I did get an error trying to load a file inside /models/item so I copied the json to that location.

 

Now there's no errors but I still have untextured, unscaled blocks.

Correction: the item that shows up in the creative inventory has a completely nill model (100% invisible) but using pickBlock results in a  missing texture cube.

 

ModelLoader.setCustomModelResourceLocation(item, 0, new ModelResourceLocation(item.getRegistryName(),"ore_density"));

where `item` is the custom item block instance.

 

I assume this is because I've only set the custom model for metadata 0.  How do I get all possible metadata values from an arbitrary block so I'm not writing special-case code for every block?  Obviously in this instance it would be 0-15, but that isn't always the case.  Also, invisible item.

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

Can't figure out how to point it at the existing BlockState json, but I did get an error trying to load a file inside /models/item so I copied the json to that location.

No, don't do that. If you have a blockstate json it must be in /blockstates/.

Post the full error.

 

This was the error (not relevant anymore, see other section).  Was for the same code above.

 

2016-07-18 19:24:48,497 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-07-18 19:24:48,498 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

[19:24:48] [main/INFO] [GradleStart]: Extra: []

[19:24:48] [main/INFO] [GradleStart]: Running with arguments: [--userProperties, {}, --assetsDir, Z:/Users/Major/.gradle/caches/minecraft/assets, --assetIndex, 1.10, --accessToken{REDACTED}, --version, 1.10.2, --tweakClass, net.minecraftforge.fml.common.launcher.FMLTweaker, --tweakClass, net.minecraftforge.gradle.tweakers.CoremodTweaker]

[19:24:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[19:24:48] [main/INFO] [LaunchWrapper]: Using primary tweak class name net.minecraftforge.fml.common.launcher.FMLTweaker

[19:24:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.CoremodTweaker

[19:24:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLTweaker

[19:24:48] [main/INFO] [FML]: Forge Mod Loader version 12.18.1.2014 for Minecraft 1.10.2 loading

[19:24:48] [main/INFO] [FML]: Java is Java HotSpot Client VM, version 1.8.0_71, running on Windows 7:x86:6.1, installed at C:\Program Files\Java\jre1.8.0_71

[19:24:48] [main/INFO] [FML]: Managed to load a deobfuscated Minecraft name- we are in a deobfuscated environment. Skipping runtime deobfuscation

[19:24:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.CoremodTweaker

[19:24:48] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.fml.relauncher.FMLCorePlugin

[19:24:48] [main/INFO] [GradleStart]: Injecting location in coremod net.minecraftforge.classloading.FMLForgePlugin

[19:24:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[19:24:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[19:24:48] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[19:24:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[19:24:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLInjectionAndSortingTweaker

[19:24:48] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[19:24:48] [main/ERROR] [FML]: The binary patch set is missing. Either you are in a development environment, or things are not going to work!

[19:24:50] [main/ERROR] [FML]: FML appears to be missing any signature data. This is not a good thing

[19:24:50] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.relauncher.CoreModManager$FMLPluginWrapper

[19:24:50] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.FMLDeobfTweaker

[19:24:50] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.gradle.tweakers.AccessTransformerTweaker

[19:24:50] [main/INFO] [LaunchWrapper]: Loading tweak class name net.minecraftforge.fml.common.launcher.TerminalTweaker

[19:24:50] [main/INFO] [LaunchWrapper]: Calling tweak class net.minecraftforge.fml.common.launcher.TerminalTweaker

[19:24:50] [main/INFO] [LaunchWrapper]: Launching wrapped minecraft {net.minecraft.client.main.Main}

2016-07-18 19:24:51,418 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-07-18 19:24:51,448 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

2016-07-18 19:24:51,449 WARN Unable to instantiate org.fusesource.jansi.WindowsAnsiOutputStream

[19:24:51] [Client thread/INFO]: Setting user: Player679

[19:24:55] [Client thread/WARN]: Skipping bad option: lastServer:

[19:24:55] [Client thread/INFO]: LWJGL Version: 2.9.4

[19:24:56] [Client thread/INFO] [sTDOUT]: [net.minecraftforge.fml.client.SplashProgress:start:221]: ---- Minecraft Crash Report ----

// Why is it breaking :(

 

Time: 7/18/16 7:24 PM

Description: Loading screen debug info

 

This is just a prompt for computer specs to be printed. THIS IS NOT A ERROR

 

 

A detailed walkthrough of the error, its code path and all known details is as follows:

---------------------------------------------------------------------------------------

 

-- System Details --

Details:

Minecraft Version: 1.10.2

Operating System: Windows 7 (x86) version 6.1

Java Version: 1.8.0_71, Oracle Corporation

Java VM Version: Java HotSpot Client VM (mixed mode), Oracle Corporation

Memory: 887610776 bytes (846 MB) / 1037959168 bytes (989 MB) up to 1037959168 bytes (989 MB)

JVM Flags: 3 total; -Xincgc -Xmx1024M -Xms1024M

IntCache: cache: 0, tcache: 0, allocated: 0, tallocated: 0

FML:

Loaded coremods (and transformers):

GL info: ' Vendor: 'ATI Technologies Inc.' Version: '4.2.11566 Compatibility Profile Context' Renderer: 'ATI Radeon HD 5570'

[19:24:57] [Client thread/INFO] [FML]: MinecraftForge v12.18.1.2014 Initialized

[19:24:57] [Client thread/INFO] [FML]: Replaced 233 ore recipes

[19:24:57] [Client thread/INFO] [FML]: Found 0 mods from the command line. Injecting into mod discoverer

[19:24:57] [Client thread/INFO] [FML]: Searching Z:\Users\Major\Desktop\Minecraft Tools\Minecraft Modding\forge 2014\run\mods for mods

[19:24:58] [Client thread/INFO] [FML]: Forge Mod Loader has identified 4 mods to load

[19:24:58] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, HarderOres] at CLIENT

[19:24:58] [Client thread/INFO] [FML]: Attempting connection with missing mods [mcp, FML, Forge, HarderOres] at SERVER

[19:24:59] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:HarderOres

[19:24:59] [Client thread/INFO] [FML]: Processing ObjectHolder annotations

[19:24:59] [Client thread/INFO] [FML]: Found 423 ObjectHolder annotations

[19:24:59] [Client thread/INFO] [FML]: Identifying ItemStackHolder annotations

[19:24:59] [Client thread/INFO] [FML]: Found 0 ItemStackHolder annotations

[19:24:59] [Client thread/INFO] [FML]: Configured a dormant chunk cache size of 0

[19:24:59] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Starting version check at http://files.minecraftforge.net/maven/net/minecraftforge/forge/promotions_slim.json

[19:24:59] [Forge Version Check/INFO] [ForgeVersionCheck]: [Forge] Found status: AHEAD Target: null

[19:24:59] [Client thread/INFO] [FML]: Applying holder lookups

[19:24:59] [Client thread/INFO] [FML]: Holder lookups applied

[19:24:59] [Client thread/INFO] [FML]: Injecting itemstacks

[19:24:59] [Client thread/INFO] [FML]: Itemstack injection complete

[19:25:02] [sound Library Loader/INFO]: Starting up SoundSystem...

[19:25:02] [Thread-8/INFO]: Initializing LWJGL OpenAL

[19:25:02] [Thread-8/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[19:25:02] [Thread-8/INFO]: OpenAL initialized.

[19:25:02] [sound Library Loader/INFO]: Sound engine started

[19:25:06] [Client thread/INFO] [FML]: Max texture size: 4096

[19:25:06] [Client thread/INFO]: Created: 16x16 textures-atlas

[19:25:07] [Client thread/ERROR] [FML]: Exception loading model for variant harderores:hardiron#ore_density for item "harderores:hardiron", normal location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model harderores:item/hardiron with loader VanillaLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:317) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:540) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_71]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.io.FileNotFoundException: harderores:models/item/hardiron.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:68) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:311) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.access$1100(ModelLoader.java:118) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:868) ~[ModelLoader$VanillaLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 20 more

[19:25:07] [Client thread/ERROR] [FML]: Exception loading model for variant harderores:hardiron#ore_density for item "harderores:hardiron", blockstate location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model harderores:hardiron#ore_density with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:325) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.registerReloadListener(SimpleReloadableResourceManager.java:122) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:540) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_71]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]

at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 20 more

[19:25:08] [Client thread/INFO] [FML]: Injecting itemstacks

[19:25:08] [Client thread/INFO] [FML]: Itemstack injection complete

[19:25:08] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[19:25:08] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:HarderOres

[19:25:10] [Client thread/INFO]: SoundSystem shutting down...

[19:25:10] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

[19:25:10] [sound Library Loader/INFO]: Starting up SoundSystem...

[19:25:11] [Thread-10/INFO]: Initializing LWJGL OpenAL

[19:25:11] [Thread-10/INFO]: (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

[19:25:11] [Thread-10/INFO]: OpenAL initialized.

[19:25:11] [sound Library Loader/INFO]: Sound engine started

[19:25:14] [Client thread/INFO] [FML]: Max texture size: 4096

[19:25:14] [Client thread/INFO]: Created: 1024x512 textures-atlas

[19:25:15] [Client thread/ERROR] [FML]: Exception loading model for variant harderores:hardiron#ore_density for item "harderores:hardiron", normal location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model harderores:item/hardiron with loader VanillaLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:317) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:338) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_71]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: java.io.FileNotFoundException: harderores:models/item/hardiron.json

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:68) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:65) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadModel(ModelBakery.java:311) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.access$1100(ModelLoader.java:118) ~[ModelLoader.class:?]

at net.minecraftforge.client.model.ModelLoader$VanillaLoader.loadModel(ModelLoader.java:868) ~[ModelLoader$VanillaLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 23 more

[19:25:15] [Client thread/ERROR] [FML]: Exception loading model for variant harderores:hardiron#ore_density for item "harderores:hardiron", blockstate location exception:

net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model harderores:hardiron#ore_density with loader VariantLoader.INSTANCE, skipping

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:153) ~[ModelLoaderRegistry.class:?]

at net.minecraftforge.client.model.ModelLoader.loadItemModels(ModelLoader.java:325) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelBakery.loadVariantItemModels(ModelBakery.java:170) ~[ModelBakery.class:?]

at net.minecraftforge.client.model.ModelLoader.setupModelRegistry(ModelLoader.java:147) ~[ModelLoader.class:?]

at net.minecraft.client.renderer.block.model.ModelManager.onResourceManagerReload(ModelManager.java:28) [ModelManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:132) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:113) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:799) [Minecraft.class:?]

at net.minecraftforge.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:338) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:561) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:386) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:118) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_71]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:135) [launchwrapper-1.12.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.12.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_71]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.8.0_71]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.8.0_71]

at net.minecraftforge.gradle.GradleStartCommon.launch(GradleStartCommon.java:97) [start/:?]

at GradleStart.main(GradleStart.java:26) [start/:?]

Caused by: net.minecraft.client.renderer.block.model.ModelBlockDefinition$MissingVariantException

at net.minecraft.client.renderer.block.model.ModelBlockDefinition.getVariant(ModelBlockDefinition.java:78) ~[ModelBlockDefinition.class:?]

at net.minecraftforge.client.model.ModelLoader$VariantLoader.loadModel(ModelLoader.java:1183) ~[ModelLoader$VariantLoader.class:?]

at net.minecraftforge.client.model.ModelLoaderRegistry.getModel(ModelLoaderRegistry.java:149) ~[ModelLoaderRegistry.class:?]

... 23 more

[19:25:15] [Client thread/WARN]: Skipping bad option: lastServer:

[19:25:16] [Realms Notification Availability checker #1/INFO]: Could not authorize you against Realms server: Invalid session id

[19:25:17] [Client thread/INFO]: Stopping!

[19:25:17] [Client thread/INFO]: SoundSystem shutting down...

[19:25:18] [Client thread/WARN]: Author: Paul Lamb, www.paulscode.com

Java HotSpot Client VM warning: Using incremental CMS is deprecated and will likely be removed in a future release

 

 

I assume this is because I've only set the custom model for metadata 0.  How do I get all possible metadata values from an arbitrary block so I'm not writing special-case code for every block?  Obviously in this instance it would be 0-15, but that isn't always the case.  Also, invisible item.

You could call setCustomModelResourceLocation for all of them or use a ItemMeshDefinition, which is basically a callback for "give me the model for this ItemStack".

 

Using an ItemMeshDefinition has mostly made things much better.  Probably the single thing I've done that hasn't made things worse before making them better.  I've got item models, but they don't show the variant textures.  They all show the default texture.

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

I....think I'm going to need an example of using it.

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

This hasn't helped any. :\

ModelBakery.registerItemVariants(item, new ModelResourceLocation(item.getRegistryName(), "inventory"));

results in using the single default variant texture.

ModelBakery.registerItemVariants(item, new ModelResourceLocation(item.getRegistryName(), "ore_density"));

results in purple squares.

 

Also do I do this before, after, or instead of ModelLoader.setCustomMeshDefinition?

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

AFAICT, this means I need a separate model file for each variant: every example I can find (vanilla, tutorials, other mods on github) all have a separate model file for each meta-variation.  Earlier you said I didn't need it and could in fact use the blockstate json file I already had.

 

So how do I do that?

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

I have a blockstate file that specifies the variants:

 

 

{
    "forge_marker": 1,
    "defaults": {
        "textures": {
            "all": "harderores:blocks/iron_ore",
            "overlay": "harderores:blocks/overlay_0",
            "particle": "harderores:blocks/iron_ore"
        },
        "model": "harderores:hardore",
        "uvlock": true
    },
    "variants": {
        "normal": [{

        }],
        "inventory": [{

        }],
        "ore_density": {
            "0": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_0"
                }
            },
            "1": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_1"
                }
            },
            "2": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_2"
                }
            },
            "3": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_3"
                }
            },
            "4": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_4"
                }
            },
            "5": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_5"
                }
            },
            "6": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_6"
                }
            },
            "7": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_7"
                }
            },
            "8": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_8"
                }
            },
            "9": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_9"
                }
            },
            "10": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_10"
                }
            },
            "11": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_11"
                }
            },
            "12": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_12"
                }
            },
            "13": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_13"
                }
            },
            "14": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_14"
                }
            },
            "15": {
                "textures": {
                    "overlay": "harderores:blocks/overlay_15"
                }
            }
        }
    }
}

 

 

Note that each variant is defined by a very generic "overlay_n" texture.  This is so that I can change ores by changing one thing between two files: the base texture.

 

I want to do this with my items.

 

How?

 

I do not want to end up with 176 virtually identical json files.  I didn't have to do it for the block, I don't want to do it for the item.

 

Thank you for linking the Forge documentation on blockstates, but it still doesn't answer the question of how do I use this for an item?

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

I want to do this with my items.

 

How?

 

I do not want to end up with 176 virtually identical json files.  I didn't have to do it for the block, I don't want to do it for the item.

 

Thank you for linking the Forge documentation on blockstates, but it still doesn't answer the question of how do I use this for an item?

 

To use the

ore_density=7

variant of the assets/harderores/blockstates/hardore.json blockstates file as an item model, use

new ModelResourceLocation("harderores:hardore", "ore_density=7")

as the location. Either pass this to

ModelLoader.setCustomModelResourceLocation

or return it from your

ItemMeshDefinition

and pass it to

ModelBakery.registerItemVariants

.

 

You can see how I register item models for my blocks with variants (using their blockstates files) here.

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

Thanks Choonster.

The example definitely helps, too.  I have a dentist appointment in about 20 minutes, so I'll poke around some more afterwards.

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

Awesome, that got things working.  Much happy.

Mostly my problem came down to not knowing what "<variant>" was supposed to be in diesieben07's explanation (the name, the value, a combination?).

 

Now I'm just on a way to generalize this into a method to take in a block (and an arbitrary list of IProperties?) and loop through the variant list without doing it manually per-block.  Doing one property was easy, it's getting the arbitrary list of them that'll be difficult.

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

You can use

Block#getBlockState

to get the

BlockStateContainer

of a

Block

. You can then use

BlockStateContainer#getProperties

to get the block's properties or

BlockStateContainer#getValidStates

to get the block's valid states.

 

You can also use

Block#getStateFromMeta

to get the state represented by a metadata value.

 

Minecraft uses

StateMapperBase#getPropertyString

to create a variant string from an ordered map of properties and values (e.g. the one returned by

IBlockState#getProperties

).

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

Ah, thank you. I knew there was something in the code that did it already, I just couldn't track it down.

I knew I could get the list of states simply by iterating through the metadata values, but that was unclean (not all blocks will have 16 states, etc.) and still didn't help translate that into a "prop=v;prop2=x" type string.

 

The state mapper though. Muuuch more useful.

 

StateMapperBase b = new DefaultStateMapper();
ImmutableList<IBlockState> values = block.getBlockState().getValidStates();
for(IBlockState state : values) {
String variant = b.getPropertyString(state.getProperties());
int metadata = block.getMetaFromState(state);
//register variant with metadata
}

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

One last question:

Any way to do something similar with regular items? All I'm seeing are these predicate overrides which point to alternate model jsons.

 

Its fine if not, just would've been nice.

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

Any

Item

can use a model specified by any blockstates JSON. Regular items obviously don't have a

Block

to get the variant names from, but you can use an enum like

ItemDye

and

ItemFishFood

do.

 

In my

ModModelManager

class, all of the overloads of

registerItemModel

are designed to be used for

Item

s that have a single model. The overloads of

registerItemModelForMeta

are designed to be used for

Item

s that have a different model for each metadata value.

 

All of these overloads just boil down to a single

ModelLoader.setCustomMeshDefinition

or

ModelLoader.setCustomModelResourceLocation

call with various default values.

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

I was looking at

ItemDye

and it forwards everything to a bunch of models.

 

But yeah, I have an enum and the ordinal of each one would be the metadata involved, but I couldn't get things pointed at a block state file in a way that the game liked.  I had things going down the same path as the metadata block, but I either got purple squares and no errors or invisible items (the textures in use at the time were vanilla items).

 

It was basically ignoring the "variants" section in the json file, as far as I could tell (as I had one or two matching the variants generated by the code below, but I wasn't getting "could not find variant in file" errors unless the json file itself didn't exist).

 

Anyway, this is the code I have:

	public void RegisterItemWithVariants(Item item, String registryname, IMetaLookup variant) {
	super.RegisterItemWithVariants(item, registryname, variant);
	List<ItemStack> list = new ArrayList<ItemStack>();
	item.getSubItems(item, CreativeTabs.SEARCH, list);
	for(ItemStack stack : list) {
		registerItemModelForMeta(item, stack.getMetadata(), variant.getName()+"="+variant.getByOrdinal(stack.getMetadata()).name());
	}
}

 

Where

registerItemModelForMeta

is that same function being used by the blocks that you had in your code and

IMetaLookup

is just an interface wrapper around the enum I'm using so I can convert it back into the variant strings similar to the block's "getPropertyString()" call (I pass in MyEnum.ARBITRARY_VALUE and it's just used to access the lookup methods).

 

(JSON file at the moment is set up with predicate overrides, not variants, so not including it).

 

Is the problem the fact that for the item it's looking at "modid:models/item" for the json file (due to

item.getRegistryName()

and I really need to point it at "modid:blockstates"?

 

TL;DR:

I'm basically scratching my head because I'm getting no feedback when something doesn't work.

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

I'm not entirely sure what you've done wrong, but you can see my implementation of an item (and its models) with enum-based metadata variants here.

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

Yeah, like I said, I'm not sure what I've done wrong either, only that no errors are logged.  I'll digest your code here in a bit.

 

One of the differences is that my enum list isn't going to be used in its entirety: I've got several ore types to deal with, but any given item won't necessarily be valid for all the ore types, e.g. metal nuggets.  I don't need to create a Gold Nugget variant item model because that item is already supplied by vanilla.  That was why I was using item.getSubItems() rather than enum.values; I want to maintain metavalues across several items.

 

Anyway, thanks for the continued help.  Eventually I'll understand how the vanilla systems work well enough to rapidly prototype items like I used to.

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

A lot of things

 

Ok, that came down to realizing that you had a custom model defined in an odd spot that I didn't notice right away.  It looked so much like something else that.

 

Urg.  So many things can go wrong with this new system, especially when trying to avoid asset bloat (seriously, vanilla has sixty four models for the clock).  And half of them don't even generate errors.*  Makes me feel like this json model system is built out of magic strings.  Which it kind of is, the problem is that it's not well documented so setting up something is either: do it the painful vanilla way or try to examine the code that parses the json files (I tried and couldn't even locate an entry point that I could follow).

 

That whole "abstractions at their core are lies" thing.

 

[me=Draco18s]archives the project in this state so if he ever needs to do this again, he has it.[/me]

 

*This is probably an exaggeration, but the number of times I've gotten purple squares or outright invisible models without a single logged error is about as many times as I've had errors.

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

I did link to an explanation of the model loading process in my first reply, you may want to look through the code paths it mentions to see how models are parsed.

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

I did link to an explanation of the model loading process in my first reply, you may want to look through the code paths it mentions to see how models are parsed.

 

I know. It was a problem of not being able to see every detail that I needed to see.

 

And I'll do that at some point, but not right away.

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

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.