Posted May 16, 201510 yr Not sure why it's not loading. I've been at this for hours. Here's the code: BlockMS.java package com.fallenmoons.moonsstuff.block; import com.fallenmoons.moonsstuff.reference.Reference; import com.fallenmoons.moonsstuff.utility.Textures; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.texture.IIconRegister; /** * Created on 5/16/2015. */ public class BlockMS extends Block { public BlockMS(Material material) { super(material); } public BlockMS() { this(Material.rock); } @Override public String getUnlocalizedName() { return String.format("tile.%s%s", Reference.MOD_ID.toLowerCase() + ":", getUnwrappedUnlocalizedName(super.getUnlocalizedName())); } @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon(String.format("$s%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()))); } protected String getUnwrappedUnlocalizedName(String unlocalizedName) { return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1); } } Block_Red.java package com.fallenmoons.moonsstuff.block; import com.fallenmoons.moonsstuff.utility.Textures; /** * Created on 5/16/2015. */ public class Block_Red extends BlockMS { public Block_Red() { super(); this.setBlockName("blockRed"); } } ModBlocks.java package com.fallenmoons.moonsstuff.init; import com.fallenmoons.moonsstuff.block.BlockMS; import com.fallenmoons.moonsstuff.block.Block_Red; import cpw.mods.fml.common.registry.GameRegistry; /** * Created on 5/16/2015. */ public class ModBlocks { public static final BlockMS blockRed = new Block_Red(); public static void init() { GameRegistry.registerBlock(blockRed, "blockRed"); } } My file structure for the texture goes like: src>main>(java is here too but that's not important)resources>assets>moonsstuff>textures>blocks>blockRed.png Thanks for the help guys, I'm really stumped. EDIT: I'd like to add that I have an item using a very similar system that displays the correct texture, but the block will not. EDIT: Fixed it. Simple mis-type. In my BlockMS.java I accidentally put a "$" in front of my "%s" so it was checking the wrong directory. @Override @SideOnly(Side.CLIENT) public void registerBlockIcons(IIconRegister iconRegister) { blockIcon = iconRegister.registerIcon(String.format("[b]$[/b]s%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName()))); }
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.