Jump to content

[Forge 1.7.2] Textures not working


Flaghacker

Recommended Posts

I'm learning how to make mods, I have a bit of Java knowledge. I'm trying to give my block "block1" and item "item1" a texture, I have made 2 .png files using paint.net.

 

This is my code:

learning.java: http://pastebin.com/9E7cN0Ur

Block1.java: http://pastebin.com/4nA0zAqX

Package explorer:

 

Texures:

block1.png:

item1.png:

 

Log file: http://pastebin.com/AxxwjUgF

Forge version: forge-1.7.2-10.12.2.1.21

 

I don't know why my textures don't work, in-game they have the purple-black "missing texture". Can anyone help me?

Link to comment
Share on other sites

                block1.setBlockTextureName(MODID + ":" + "block1.png"); 

 

if you add .PNG at the end of the name it try to find MODID/textures/blocks/block1.png.png

 

                block1.setBlockTextureName(MODID + ":block1"); 

 

try this. And if this isn't work try this;

                block1.setBlockTextureName("block1"); 

 

and add block1.java

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister reg) {
	this.blockIcon = reg.registerIcon(learning.MODID + ":" + this.getTextureName());
}

 

Or also you can use my addBlock function

 

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.extend.mod.ref;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.util.IIcon;

public class addblock extends Block {
public addblock(String name, Material material, SoundType sound, float hardness, String item, int level) {
	super(material);

	this.setHardness(hardness);
	this.setStepSound(sound);
	this.setCreativeTab(CreativeTabs.tabBlock);
	this.setBlockName(name);
	this.setBlockTextureName(name);
	this.setHarvestLevel(item, level);
	GameRegistry.registerBlock(this, name);
}

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister reg) {
	this.blockIcon = reg.registerIcon(ref.uid + ":" + this.getTextureName());
}
}

 

when you register;

public static Block blackDiamondOre;
public static Block blackDiamondBlock;

this.blackDiamondBlock = new addblock("blackdiamondblock", Material.iron, Block.soundTypeStone, 2.0F, "pickaxe", 2);
       	this.blackDiamondOre = new addore("blackdiamondore", Block.soundTypeStone, 4.0F, "pickaxe", 2);

Link to comment
Share on other sites

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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