Posted March 31, 20187 yr Now I am having trouble with getting block textures to work. The best I have been able to do is get it to where a block doesn't have textures when in the inventory screen or when dropped but it does have a texture when I place the block. Here is a screen shot of what it looks like. I've tried a whole lot of things, but what I have right now is the only thing that will at least allow textures to show up when the block is placed instead of make it so that no textures show up period. Here is all my relevant code: Block and item registration in my main class file: @Mod.EventBusSubscriber(modid = SuperTNTMod.MODID) public static class RegistrationHandler { public static final Set<ItemBlock> ITEM_BLOCKS = new HashSet<>(); /** * Register this mod's {@link Block}s. * * @param event The event */ @SubscribeEvent public static void registerBlocks(final RegistryEvent.Register<Block> event) { final IForgeRegistry<Block> registry = event.getRegistry(); System.out.println("register blocks event executed"); final Block[] blocks = {WHATEVER_TEST, WHATEVER_TEST_SECOND}; registry.registerAll(blocks); System.out.println("register all function executed"); } @SubscribeEvent public static void registerItemBlocks(final RegistryEvent.Register<Item> event) { final ItemBlock[] items = { new ItemBlock(WHATEVER_TEST), new ItemBlock(WHATEVER_TEST_SECOND), }; final IForgeRegistry<Item> registry = event.getRegistry(); for (final ItemBlock item : items) { final Block block = item.getBlock(); final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block); registry.register(item.setRegistryName(registryName)); ITEM_BLOCKS.add(item); } //registerTileEntities(); } } Here is the block class file of the block in the picture if it matters package com.xeraster.supertnt.blocks; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class BlockTestBlock extends BlockBase{ public BlockTestBlock(String name, Material mat, CreativeTabs tab, float hardness, float resistance, String tool, int harvest) { super(name, mat, tab, hardness, resistance, tool, harvest); } } Here is a picture of the file tree Here are the contents of "testblock.json" located in blockstates: { "variants": { "normal": {"model": "supertnt:testblock"} } } Here are the contents of "testblock.json" located in models/block { "parent": "block/cube_all", "textures": { "all": "supertnt:blocks/testblock" } } And lastly, here are the contents of "testblock.json" located in models/item { "parent": "supertnt:block/testblock" } I can't seem to figure out why any of this doesn't work as expected. If anyone could point out where I'm wrong and how to fix it that would be great. Thanks in advance. Edited March 31, 20187 yr by Xeraster
March 31, 20187 yr Where's your code where you register the block models and item block models? Also, do you see any console or logger errors related to missing models or textures? Post the console log. Lastly, these things are always a matter of the details. I would add even more print statements to make sure everything, like the registry names and such are fully correct. You can also use debug mode in your IDE to check this. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
March 31, 20187 yr You need to register models for your ItemBlocks 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.
March 31, 20187 yr Author Ok I got it. It turned out I wasn't fully registering everything as I was forgetting to use onRegisterModels. Thanks a lot
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.