Jump to content

[1.7.10] Texture not showing, Name and lang are okay. [SOLVED]


FallenMoons

Recommended Posts

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())));
}

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.