So I've been wanting to do colored blocks (like wool or hardened clay) and KNOW for sure that it is done by metadata and all, but when I've tried going into the classes, well, nothing special. Even the blockstates and all were normal (like a normal block non-colored block).
I'm being really confused...
Do I just have to use regular metadatas like any other blokc with varients or is there some special thing for blocks such as these ?
There's nothing special about these blocks, they simply use a PropertyEnum<EnumDyeColor> that's mapped to metadata values 0-15.
This is implemented by BlockColored, you can use or extend this for your own coloured blocks.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
There's nothing special about these blocks, they simply use a PropertyEnum<EnumDyeColor> that's mapped to metadata values 0-15.
This is implemented by BlockColored, you can use or extend this for your own coloured blocks.
Okay, so I've tried using the EnumDyeColor, but it seems I don't really understand how it works. I spent a lot of time trying to figure out how this works but I couldn't...
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Here's the log : https://gist.github.com/Frousties/8f9b841699b2755420992d0e3a87ed66
I've reloaded textures multiple times after changing blockstates model and all since it says that it has problem loading the model attached for this color, while he actually CAN. Also ignore everything related to sounds, it is weird, the sounds work fine but I still get error messages
(updated Gihub)
Also the 16 blocks are actually generated but without unique metadata (the id is always #xxxx and not #xxxx/x). whenever I place these blocks, they all take the base texture (the white one) and have the "missing texture" item model.
[13:27:33] [Client thread/ERROR] [FML]: Exception loading model for variant randomdumps:BlockConcretePowder#color=gray for blockstate "randomdumps:BlockConcretePowder[color=gray]"
net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model randomdumps:BlockConcretePowder#color=gray with loader VariantLoader.INSTANCE, skipping
...
Caused by: net.minecraftforge.client.model.ModelLoaderRegistry$LoaderException: Exception loading model randomdumps:block/BlockConcretePowderGray with loader VanillaLoader.INSTANCE, skipping
...
Caused by: java.io.FileNotFoundException: randomdumps:models/block/BlockConcretePowderGray.json
You've told Minecraft to look for BlockConcretePowderGray.json, but your model is called BlockConcretePowderGrey.json.
For blocks with variants, you need to use an ItemBlock class that calls Item#setHasSubtypes in the constructor. ItemCloth does this and also appends the colour represented by the ItemStack's metadata to the unlocalised name, allowing each colour to have its own localised name.
You also need to call ModelLoader.setCustomModelResourceLocation for each metadata value of the ItemBlock to tell Minecraft which model to use.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You've told Minecraft to look for BlockConcretePowderGray.json, but your model is called BlockConcretePowderGrey.json.
For blocks with variants, you need to use an ItemBlock class that calls Item#setHasSubtypes in the constructor. ItemCloth does this and also appends the colour represented by the ItemStack's metadata to the unlocalised name, allowing each colour to have its own localised name.
You also need to call ModelLoader.setCustomModelResourceLocation for each metadata value of the ItemBlock to tell Minecraft which model to use.
I've tried adding an Itemblock with variants but now the game is just crashing whenever I launch it
net.minecraftforge.fml.common.LoaderExceptionModCrash: Caught exception from Frousties' Random Dumps (randomdumps)
Caused by: java.lang.NullPointerException
at net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:396)
at net.minecraftforge.fml.common.registry.GameData$ItemCallbacks.onAdd(GameData.java:385)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.addObjectRaw(FMLControlledNamespacedRegistry.java:598)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.add(FMLControlledNamespacedRegistry.java:496)
at net.minecraftforge.fml.common.registry.FMLControlledNamespacedRegistry.register(FMLControlledNamespacedRegistry.java:849)
at net.minecraftforge.fml.common.registry.GameData.register_impl(GameData.java:254)
at net.minecraftforge.fml.common.registry.GameRegistry.register(GameRegistry.java:153)
at com.randomdumps.mod.init.RandomItems.register(RandomItems.java:39)
at com.randomdumps.mod.RandomDumps.preInit(RandomDumps.java:41)
It looks like you registered an ItemBlock with a nullBlock.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I've went to these locations but I don't see where there is a null Block or an empty declaration of some sort
Do I have to do register ItemBlocks in a special way and not like any regular item ?
I've went to these locations but I don't see where there is a null Block or an empty declaration of some sort
Do I have to do register ItemBlocks in a special way and not like any regular item ?
You're calling RandomItems.init/register before RandomBlocks.init/register, so all the fields of RandomBlocks are still null when you try to register ItemBlocks for them.
You need to register your Blocks first, then your Items (including ItemBlocks).
You should be registering your Blocks, Items and other IForgeRegistryEntry implementations in the appropriate registry events rather than preInit, this ensures they're registered at the right time and in the right order. You can see examples of this in my mod's init classes.
Rollback Post to RevisionRollBack
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
You're calling RandomItems.init/register before RandomBlocks.init/register, so all the fields of RandomBlocks are still null when you try to register ItemBlocks for them.
You need to register your Blocks first, then your Items (including ItemBlocks).
You should be registering your Blocks, Items and other IForgeRegistryEntry implementations in the appropriate registry events rather than preInit, this ensures they're registered at the right time and in the right order. You can see examples of this in my mod's init classes.
Thanks you ! It works now. ICAN'T BELIEVE I've done such a BASIC error ;_;
There are just still the old "auto-generated" blocks. Is this because I extended BlockColored ?
(GitHub updated)
EDIT: Fixed that last issue ! Figured I was still registering the old itemblocks
Hello, (again)
So I've been wanting to do colored blocks (like wool or hardened clay) and KNOW for sure that it is done by metadata and all, but when I've tried going into the classes, well, nothing special. Even the blockstates and all were normal (like a normal block non-colored block).
I'm being really confused...
Do I just have to use regular metadatas like any other blokc with varients or is there some special thing for blocks such as these ?
There's nothing special about these blocks, they simply use a PropertyEnum<EnumDyeColor> that's mapped to metadata values 0-15.
This is implemented by BlockColored, you can use or extend this for your own coloured blocks.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Okay, so I've tried using the EnumDyeColor, but it seems I don't really understand how it works. I spent a lot of time trying to figure out how this works but I couldn't...
Here's my block class : https://github.com/Frousties/Frousties-Random-Dumps/blob/master/src/main/java/com/randomdumps/mod/blocks/BlockConcretePowder.java
My Blockstate : https://github.com/Frousties/Frousties-Random-Dumps/blob/master/src/main/resources/assets/randomdumps/blockstates/BlockConcretePowder.json
Either copy BlockColored or extend it, don't do both. Preferably extend it.
Is it not working? Post the FML log using Gist.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Here's the log : https://gist.github.com/Frousties/8f9b841699b2755420992d0e3a87ed66
I've reloaded textures multiple times after changing blockstates model and all since it says that it has problem loading the model attached for this color, while he actually CAN. Also ignore everything related to sounds, it is weird, the sounds work fine but I still get error messages
(updated Gihub)
Also the 16 blocks are actually generated but without unique metadata (the id is always #xxxx and not #xxxx/x). whenever I place these blocks, they all take the base texture (the white one) and have the "missing texture" item model.
You've told Minecraft to look for BlockConcretePowderGray.json, but your model is called BlockConcretePowderGrey.json.
For blocks with variants, you need to use an ItemBlock class that calls Item#setHasSubtypes in the constructor. ItemCloth does this and also appends the colour represented by the ItemStack's metadata to the unlocalised name, allowing each colour to have its own localised name.
You also need to call ModelLoader.setCustomModelResourceLocation for each metadata value of the ItemBlock to tell Minecraft which model to use.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I've tried adding an Itemblock with variants but now the game is just crashing whenever I launch it
Crashlog: https://gist.github.com/Frousties/da9645737280fbd4ae27ad29e9263ffb
It looks like you registered an ItemBlock with a null Block.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Well I literally have no idea of where I did that
Look at the stacktrace I quoted, it tells you.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
I've went to these locations but I don't see where there is a null Block or an empty declaration of some sort
Do I have to do register ItemBlocks in a special way and not like any regular item ?
You're calling RandomItems.init/register before RandomBlocks.init/register, so all the fields of RandomBlocks are still null when you try to register ItemBlocks for them.
You need to register your Blocks first, then your Items (including ItemBlocks).
You should be registering your Blocks, Items and other IForgeRegistryEntry implementations in the appropriate registry events rather than preInit, this ensures they're registered at the right time and in the right order. You can see examples of this in my mod's init classes.
Chisel Facades: For all your decorative pipe-hiding needs.
Please don't PM me to ask for help or to join your mod development team. Asking your question in a public thread preserves it for people who are having the same problem in the future. I'm not interested in developing mods with people.
Thanks you ! It works now. ICAN'T BELIEVE I've done such a BASIC error ;_;
There are just still the old "auto-generated" blocks. Is this because I extended BlockColored ?
(GitHub updated)
EDIT: Fixed that last issue ! Figured I was still registering the old itemblocks