Janrupf Posted January 1, 2018 Posted January 1, 2018 Hi, I'm trying to create a new block and it is working fine in the inventory! But as soon as I place this block ist has this "Missing Texture"-texture. I searched alot and I still don't know my failure Here are some resources: assets/tekklands/blockstates/block_ore_tekknium_infused_diamond.json: (Blockstate) Reveal hidden contents { "forge_marker": 1, "defaults": { "model": "cube_all", "transform": "forge:default-block" }, "variants": { "inventory": [ { "textures": { "all": "tekklands:blocks/tekknium_infused_diamond_ore" } } ], "normal": [ { "textures": { "all": "tekklands:blocks/tekknium_infused_diamond_ore" } } ] } } assets/tekklands/models/block/block_ore_tekknium_infused_diamond.json: (Block model) Reveal hidden contents { "parent": "block/cube_all", "textures": { "all": "tekklands:blocks/tekknium_infused_diamond_ore" } } And JavaCode: BlockBase: Reveal hidden contents package net.jan.tekklands.blocks; import net.jan.tekklands.TekklandsMod; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; public class BlockBase extends Block { protected String name; public BlockBase(Material material, String unlocalizedName, String registryMame) { super(material); this.name = unlocalizedName; setUnlocalizedName(unlocalizedName); setRegistryName(registryMame); setCreativeTab(TekklandsMod.TEKKLANDS_TAB); } public void registerItemModel(Item itemBlock) { TekklandsMod.proxy.registerItemRenderer(itemBlock, 0, name); } public Item createItemBlock() { return new ItemBlock(this).setRegistryName(getRegistryName()); } @SuppressWarnings("NullableProblems") @Override public BlockBase setCreativeTab(CreativeTabs tab) { super.setCreativeTab(tab); return this; } @Override public BlockBase setResistance(float resistance) { super.setResistance(resistance); return this; } @Override public BlockBase setHardness(float hardness) { super.setHardness(hardness); return this; } } TekklandsBlocks: Reveal hidden contents package net.jan.tekklands.blocks; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraftforge.registries.IForgeRegistry; public class TekklandsBlocks { public static BlockBase tekkniumInfusedDiamondOre = new BlockBase(Material.ROCK, "block_ore_tekknium_infused_diamond", "blockOreTekkniumInfusedDiamond").setResistance(5F).setHardness(3F); public static void register(IForgeRegistry<Block> registry) { registry.register(tekkniumInfusedDiamondOre); } public static void registerItemBlocks(IForgeRegistry<Item> registry) { registry.register(tekkniumInfusedDiamondOre.createItemBlock()); } public static void registerModels() { tekkniumInfusedDiamondOre.registerItemModel(Item.getItemFromBlock(tekkniumInfusedDiamondOre)); } } ClientProxy: Reveal hidden contents package net.jan.tekklands.proxy; import net.jan.tekklands.TekklandsMod; import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class ClientProxy extends CommonProxy { @Override public void registerItemRenderer(Item item, int meta, String id) { ModelLoader.setCustomModelResourceLocation(item, meta, new ModelResourceLocation(TekklandsMod.MOD_ID + ":" + id, "inventory")); } } TekklandsMod: Reveal hidden contents package net.jan.tekklands; import net.jan.tekklands.blocks.TekklandsBlocks; import net.jan.tekklands.items.TekklandsItems; import net.jan.tekklands.proxy.CommonProxy; import net.jan.tekklands.util.Utils; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.NonNullList; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.fml.common.DummyModContainer; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @Mod( modid = TekklandsMod.MOD_ID, name = TekklandsMod.MOD_NAME, version = TekklandsMod.VERSION ) public class TekklandsMod { public static final String MOD_ID = "tekklands"; public static final String MOD_NAME = "Tekklands"; public static final String VERSION = "0.0.1-ALPHA"; public static final CreativeTabs TEKKLANDS_TAB = new CreativeTabs("Tekklands") { { setBackgroundImageName("item_search.png"); } @Override public ItemStack getTabIconItem() { return new ItemStack(TekklandsItems.itemTekkniumInfusedDiamond); } @Override public boolean hasSearchBar() { return true; } }; @Mod.Instance(MOD_ID) public static TekklandsMod INSTANCE; @SidedProxy(serverSide = "net.jan.tekklands.proxy.CommonProxy", clientSide = "net.jan.tekklands.proxy.ClientProxy") public static CommonProxy proxy; @Mod.EventHandler public void preinit(FMLPreInitializationEvent event) { } @Mod.EventHandler public void init(FMLInitializationEvent event) { } @Mod.EventHandler public void postinit(FMLPostInitializationEvent event) { } @Mod.EventBusSubscriber public static class ObjectRegistryHandler { @SubscribeEvent public static void addItems(RegistryEvent.Register<Item> event) { TekklandsItems.register(event.getRegistry()); TekklandsBlocks.registerItemBlocks(event.getRegistry()); } @SubscribeEvent public static void addModels(ModelRegistryEvent event) { TekklandsItems.registerModels(); TekklandsBlocks.registerModels(); } @SubscribeEvent public static void addBlocks(RegistryEvent.Register<Block> event) { TekklandsBlocks.register(event.getRegistry()); } } } Well, and one Screenshot: Reveal hidden contents Uhm, attached ;) Quote
Matryoshika Posted January 1, 2018 Posted January 1, 2018 (edited) Problematic Code #1 Do not register your blocks/items by calling IForgeRegistry::register. Instead of creating your ModelResourceLocation as modid+":"+id, just call Item::getRegistryName. It has already been formatted to "modid:id" for you "behind the curtains" Please also add the fml-client-latest.log found in <modding-directory>/run/logs. Paste the contents to pastebin.com or as a github Gist. Please do not upload the file directly here, or copy/paste the contents as a post. Edited January 1, 2018 by Matryoshika Quote 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.
Janrupf Posted January 1, 2018 Author Posted January 1, 2018 Ok, how should I register my item's and block's? Waiting for these event's and then with GameRegistry? latest log Quote
Matryoshika Posted January 1, 2018 Posted January 1, 2018 Registering blocks & Items using the Register<IForgeRegistry> eventsRegistering models during the ModelRegistryEvent oh, I missed one thing earlier. You never in any way connect the BlockState JSON to the model JSON. You're just stating "use this texture". Inside the variant "normal" [{}] in your BlockState, add a "model": "modid:name". Example: "normal": [{ "model": "underworld:blockbrazier" }} (It seems like you're in-between different formats. One that declares everything inside the BlockState JSON (which doesn't need any models) and one that makes use of a ready model JSON. I took the liberty of directing you to make full use of the second option, as you already had a JSON for that.) Quote 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.
Draco18s Posted January 1, 2018 Posted January 1, 2018 On 1/1/2018 at 6:41 PM, Janrupf said: item's and block's Expand Your item's and block's what? Quote 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.
Janrupf Posted January 1, 2018 Author Posted January 1, 2018 (edited) I think I understood something wrong: assets/tekklands/blockstates/block_ore_tekknium_infused_diamond.json: (Blockstate) { "forge_marker": 1, "defaults": { "model": "cube_all", "transform": "forge:default-block" }, "variants": { "inventory": [ { "textures": { "all": "tekklands:blocks/tekknium_infused_diamond_ore" } } ], "normal": [ { "model": "tekklands:block_ore_tekknium_infused_diamond" } ] } } Reveal hidden contents I didnd't change the the model json but now it is this big block without any texture or model. Edited January 1, 2018 by Janrupf Quote
Draco18s Posted January 1, 2018 Posted January 1, 2018 On 1/1/2018 at 7:28 PM, Janrupf said: Oh come on I'm not englisch ^^ Expand Some people are and they still use the apostrophe wrong. Quote 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.
LeoCTH Posted January 4, 2018 Posted January 4, 2018 ......... why you use forge blockstates? vanilla blockstates are enough to handle it Quote
larsgerrits Posted January 4, 2018 Posted January 4, 2018 On 1/4/2018 at 8:56 AM, LeoCTH said: ......... why you use forge blockstates? vanilla blockstates are enough to handle it Expand The Forge blockstate format is version based ("forge_marker": 1, AKA version 1), which is pretty much guaranteed to be backwards compatibly, while the vanilla version isn't. @OP you only set the textures in the inventory state, so they don't get set for the other states. Set the textures in both states, or set them in the defaults tag so it gets set for all states. Quote Don't PM me with questions. They will be ignored! Make a thread on the appropriate board for support. 1.12 -> 1.13 primer by williewillus. 1.7.10 and older versions of Minecraft are no longer supported due to it's age! Update to the latest version for support. http://www.howoldisminecraft1710.today/
Draco18s Posted January 4, 2018 Posted January 4, 2018 On 1/4/2018 at 8:56 AM, LeoCTH said: ......... why you use forge blockstates? vanilla blockstates are enough to handle it Expand Because the vanilla blockstate format looks like this: "stateA=1,stateB=1,stateC=1,stateD=1" : { ... } "stateA=1,stateB=1,stateC=1,stateD=2" : { ... } "stateA=1,stateB=1,stateC=2,stateD=1" : { ... } "stateA=1,stateB=1,stateC=2,stateD=2" : { ... } ... //11 nearly identical lines skipped "stateA=2,stateB=2,stateC=2,stateC=2" : { ... } And the forge blockstate format looks like this: "stateA" : { "1" : { ... }, "2" : { ... } } "stateB" : { "1" : { ... }, "2" : { ... } } "stateC" : { "1" : { ... }, "2" : { ... } } "stateD" : { "1" : { ... }, "2" : { ... } } Which would you rather write? Quote 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.
LeoCTH Posted January 5, 2018 Posted January 5, 2018 On 1/4/2018 at 6:00 PM, Draco18s said: Because the vanilla blockstate format looks like this: "stateA=1,stateB=1,stateC=1,stateD=1" : { ... } "stateA=1,stateB=1,stateC=1,stateD=2" : { ... } "stateA=1,stateB=1,stateC=2,stateD=1" : { ... } "stateA=1,stateB=1,stateC=2,stateD=2" : { ... } ... //11 nearly identical lines skipped "stateA=2,stateB=2,stateC=2,stateC=2" : { ... } And the forge blockstate format looks like this: "stateA" : { "1" : { ... }, "2" : { ... } } "stateB" : { "1" : { ... }, "2" : { ... } } "stateC" : { "1" : { ... }, "2" : { ... } } "stateD" : { "1" : { ... }, "2" : { ... } } Which would you rather write? Expand ...... Still, when you make something like multifacing blocks then you should use forge. but if you could use vanilla blockstate JSONs then WHY you'll need more complicated forge ones? (Like when handling VERY simple blocks) Quote from Forge Docs: Quote You don’t have to use Forge’s blockstate format at all, you can also use the vanilla format! Expand lol? Quote
Draco18s Posted January 5, 2018 Posted January 5, 2018 On 1/5/2018 at 1:56 AM, LeoCTH said: but if you could use vanilla blockstate JSONs then WHY you'll need more complicated forge ones? Expand Which one of those two samples that I posted was more complicated? Quote 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.
LeoCTH Posted January 5, 2018 Posted January 5, 2018 (edited) On 1/5/2018 at 3:16 AM, Draco18s said: Which one of those two samples that I posted was more complicated? Expand I mean the “forge_marker”s, all of the "defaults": { "model": "cube_all", "transform": "forge:default-block" }, "variants": { "inventory": [ { "textures": { "all": "tekklands:blocks/tekknium_infused_diamond_ore" } } ], "normal": [ { "textures": { "all": "tekklands:blocks/tekknium_infused_diamond_ore" } } ] } -ish stuff... as the docs said: "You can also use vanilla format!" why shall we use forge blockstate JSONs? Edited January 5, 2018 by LeoCTH grammar Quote
Draco18s Posted January 5, 2018 Posted January 5, 2018 On 1/5/2018 at 3:44 AM, LeoCTH said: I mean the “forge_marker”s, all of the [...] -ish stuff... Expand You know how much of what you posted was Forge format specific? None of it. Quote 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.
LeoCTH Posted January 5, 2018 Posted January 5, 2018 On 1/5/2018 at 3:53 AM, Draco18s said: You know how much of what you posted was Forge format specific? None of it. Expand I mean, why I NEEDS TO AND MUST TO use forge? why NOT vanilla? Quote
Draco18s Posted January 5, 2018 Posted January 5, 2018 On 1/5/2018 at 3:55 AM, LeoCTH said: I mean, why I NEEDS TO AND MUST TO use forge? why NOT vanilla? Expand YOU DON'T HAVE TO. NO ONE SAID YOU DID. YOUR the one who started asking about Forge blockstates. And this isn't even your thread! The whole reason the Forge format exists is to simplify complex state mappings (two or more different values) as Forge will do the cartesian grid for you (so you a) don't have to type out 366 lines of JSON and b) don't have to sort them alphabetically and get it wrong by fucking up and adding a space where one shouldn't be). 1 Quote 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.
LeoCTH Posted January 5, 2018 Posted January 5, 2018 On 1/5/2018 at 4:29 AM, Draco18s said: YOU DON'T HAVE TO. NO ONE SAID YOU DID. YOUR the one who started asking about Forge blockstates. And this isn't even your thread! The whole reason the Forge format exists is to simplify complex state mappings (two or more different values) as Forge will do the cartesian grid for you (so you a) don't have to type out 366 lines of JSON and b) don't have to sort them alphabetically and get it wrong by fucking up and adding a space where one shouldn't be). Expand I'm just asking HIM, the POSTER of the thread and at least two people INTERRUPTED me and the POSTER don't even speak ANYTHING. I apologize for replying someone frequently in other's thread, but WHY I'm asking someone else and you guy wanna join into it? And why the heck are you kinda pissed off and spit it at me? Again, I'm asking the one who have the problem. PS. Are you misunderstanding me as "I have the problem"? no, not at all. I can figure out myself while I'm doing THIS level of things. PPS. You and that largs guy are NOT the ones I'm asking. Need to tell you again? Quote
LeoCTH Posted January 5, 2018 Posted January 5, 2018 (edited) Ok, things done. I quit this thread. If the owner of this thread want to tell me, it's his opinion. Again, I don't have that problem AT ALL when I'm creating a very very super duper easy placeholder-leveled block. Edited January 5, 2018 by LeoCTH specific someone Quote
Recommended Posts
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.