Posted January 20, 20187 yr Hi, I'm having an issue with getting my Block to display in game. The ItemBlock is clearly registered and working correctly as the texture displays in inventory and when dropped. However placing the block gives a no texture purple/black cube at first. Then if you stop looking at it, respawn, or reload the world, the texture becomes invisible. Jumping on top of the block causes a weird glitchy effect, and they don't seem to be able to be broken at this point, but can be mined before the texture disappears. Never experienced anything like this before but I am rewriting my mod for 1.12 following a tutorial because I'm not that familiar with the 1.12 changes and I'm a bit rusty at this. Here are the relevant .java files. Any ideas on what I'm missing here? MoreFuelsMod.java (Main class) Spoiler package com.bored.morefuelsmod; import com.bored.morefuelsmod.block.ModBlocks; import com.bored.morefuelsmod.item.ModItems; import com.bored.morefuelsmod.proxy.CommonProxy; import net.minecraft.block.Block; import net.minecraft.init.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemArmor; import net.minecraftforge.client.event.ModelRegistryEvent; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.SidedProxy; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; import net.minecraftforge.fml.common.registry.GameRegistry; import net.minecraftforge.fml.relauncher.Side; @Mod(modid = MoreFuelsMod.modId, name = MoreFuelsMod.name, version = MoreFuelsMod.version) public class MoreFuelsMod { public static final String modId = "morefuelsmod"; public static final String name = "More Fuels Mod"; public static final String version = "1.6.3"; @Mod.Instance(modId) public static MoreFuelsMod instance; @SidedProxy(serverSide = "com.bored.morefuelsmod.proxy.CommonProxy", clientSide = "com.bored.morefuelsmod.proxy.ClientProxy") public static CommonProxy proxy; @Mod.EventHandler public void preInit(FMLPreInitializationEvent event) { System.out.println(name + " " + version + " is loading!"); } @Mod.EventHandler public void init(FMLInitializationEvent event) { } @Mod.EventHandler public void postInit(FMLPostInitializationEvent event) { } @Mod.EventBusSubscriber public static class RegistrationHandler { @SubscribeEvent public static void registerItems(RegistryEvent.Register<Item> event) { ModItems.register(event.getRegistry()); ModBlocks.registerItemBlocks(event.getRegistry()); } @SubscribeEvent public static void registerItems(ModelRegistryEvent event) { ModItems.registerModels(); ModBlocks.registerModels(); } public static void registerBlocks(RegistryEvent.Register<Block> event) { ModBlocks.register(event.getRegistry()); } } } BlockBase.java Spoiler package com.bored.morefuelsmod.block; 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; import com.bored.morefuelsmod.MoreFuelsMod; public class BlockBase extends Block { protected String name; public BlockBase(Material material, String name) { super(material); this.name = name; setUnlocalizedName(name); setRegistryName(name); } public void registerItemModel(Item item) { MoreFuelsMod.proxy.registerItemRenderer(item, 0, name); } public Item createItemBlock() { return new ItemBlock(this).setRegistryName(getRegistryName()); } @Override public BlockBase setCreativeTab(CreativeTabs tab) { super.setCreativeTab(tab); return this; } } BlockOre.java Spoiler package com.bored.morefuelsmod.block; import net.minecraft.block.material.Material; import net.minecraft.creativetab.CreativeTabs; public class BlockOre extends BlockBase { public BlockOre(String name){ super(Material.ROCK, name); setHardness(3f); setResistance(5f); } @Override public BlockOre setCreativeTab(CreativeTabs tab) { super.setCreativeTab(tab); return this; } } ModBlocks.java Spoiler package com.bored.morefuelsmod.block; import net.minecraft.block.Block; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; import net.minecraftforge.registries.IForgeRegistry; public class ModBlocks { public static BlockOre oreBituminousCoal = new BlockOre("ore_bituminous_coal").setCreativeTab(CreativeTabs.MATERIALS); public static void register(IForgeRegistry<Block> registry) { registry.registerAll( oreBituminousCoal ); } public static void registerItemBlocks(IForgeRegistry<Item> registry) { registry.registerAll( oreBituminousCoal.createItemBlock() ); } public static void registerModels() { oreBituminousCoal.registerItemModel(Item.getItemFromBlock(oreBituminousCoal)); } } ore_bituminous_coal.json (Blockstates) Spoiler { "forge_marker": 1, "defaults": { "textures": { "all": "morefuelsmod:blocks/ore_bituminous_coal" } }, "variants": { "normal": { "model": "cube_all" }, "inventory": { "model": "cube_all" } } }
January 20, 20187 yr Author 1 minute ago, diesieben07 said: You are not registering your blocks, because your registerBlocks method is not marked as an event handler. Oh wow. Can't believe I missed that haha. Thanks so much for the help.
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.