Jump to content

[1.7.2]textures don't work


Kuuu

Recommended Posts

Hello!

forge 1.7.2 is out, so I started to update my mods, but I have a problem with textures.

 

Here is my code:

 

public static Block CopperOre = new CopperOre(Material.field_151570_A).func_149663_c("CopperOre").func_149658_d("CopperOre").func_149647_a(CreativeTabs.tabBlock);

 

and CopperOre.java:

package com.test.testmod;

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;
import net.minecraft.creativetab.CreativeTabs;

public class CopperOre extends Block {

public CopperOre(Material par2Material) 
{
	super(par2Material);
	func_149647_a(CreativeTabs.tabBlock);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
    {
        this.field_149761_L = par1IconRegister.registerIcon("testmod:CopperOre");
    }
}

 

 

I put my texture in forge\src\main\resources\assets\test\textures\blocks

 

I think it should work, but it doesn't.

 

Please help me.

Link to comment
Share on other sites

Here is full code:

Base.java

 

 

package com.test.testmod;

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.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid = "testmod", version = Base.VERSION, name = "testmod")
public class Base
{
    public static final String MODID = "testmod";
    public static final String VERSION = "1.0";
    
    public static Block CopperOre = new CopperOre(Material.field_151570_A).func_149663_c("CopperOre").func_149658_d("CopperOre").func_149647_a(CreativeTabs.tabBlock);
    public static Item CopperIngot = new CopperIngot(64).setUnlocalizedName("CopperIngot").setCreativeTab(CreativeTabs.tabMaterials).setTextureName("CopperIngot");

    
    @EventHandler
    public void init(FMLInitializationEvent event)
    { 
    	GameRegistry.registerBlock(CopperOre, "CopperOre");
    	LanguageRegistry.addName(CopperOre, "Copper Ore");
    	
    	GameRegistry.registerItem(CopperIngot, "CopperIngot");
    	LanguageRegistry.addName(CopperIngot, "Copper Ingot");
    	
    	GameRegistry.addRecipe(new ItemStack(CopperOre, 1), new Object[]
    			{
    				"XXX", "XXX","XXX", 'X', Block.func_149684_b("dirt")
    			});
    	
    	GameRegistry.addRecipe(new ItemStack(CopperIngot, 1), new Object[]
    			{
    				"XXX", "XXX","XXX", 'X', CopperOre
    			});
    }
}

 

 

 

 

CopperOre.java

 

 

package com.test.testmod;

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;
import net.minecraft.creativetab.CreativeTabs;

public class CopperOre extends Block {

public CopperOre(Material par2Material) 
{
	super(par2Material);
	func_149647_a(CreativeTabs.tabBlock);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
    {
        this.field_149761_L = par1IconRegister.registerIcon("testmod:CopperOre");
    }
}

 

 

 

 

CopperIngot.java

 

 

package com.test.testmod;

import net.minecraft.item.Item;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;

public class CopperIngot extends Item
{
public CopperIngot(int j)
{
	maxStackSize=j;
	setCreativeTab(CreativeTabs.tabMaterials);
}

@Override
public void registerIcons(IIconRegister par1IconRegister)
    {
        this.itemIcon = par1IconRegister.registerIcon("testmod:CopperIngot");
    }
}

 

 

 

and here's screenshot of path to textures:

http://img835.imageshack.us/img835/9494/m2bt.png

 

I wonder if someone could help me

Link to comment
Share on other sites

I'm assuming one of this function (.func_149663_c("CopperOre")  .func_149658_d("CopperOre") form Base.java) is .setUnlocalizedName() and the other is maybe .setTexture()

yes, they're.

I didn't understand what I must do to tell minecraft that the texture is in testmod folder

I changed .setTextureName("CopperIngot") to .setTextureName("testmod:CopperIngot"), but still doesn't work

 

 

Link to comment
Share on other sites

I tried it, but still doesn't work

 

Define "doesn't work."  Without a description of what is (still) wrong and your current code, we cannot diagnose the cause.

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.

Link to comment
Share on other sites

Instead of my textures for block and item I have "missing textures"

 

current code:

 

Base.java

 

 

package com.test.testmod;

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.ItemStack;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.common.registry.LanguageRegistry;

@Mod(modid = "testmod", version = Base.VERSION, name = "testmod")
public class Base
{
    public static final String MODID = "testmod";
    public static final String VERSION = "1.0";
    
    public static Block CopperOre = new CopperOre(Material.field_151570_A).func_149647_a(CreativeTabs.tabBlock);
    public static Item CopperIngot = new CopperIngot(64).setUnlocalizedName("CopperIngot").setCreativeTab(CreativeTabs.tabMaterials);

    
    @EventHandler
    public void init(FMLInitializationEvent event)
    { 
    	GameRegistry.registerBlock(CopperOre, "CopperOre");
    	LanguageRegistry.addName(CopperOre, "Copper Ore");
    	
    	GameRegistry.registerItem(CopperIngot, "CopperIngot");
    	LanguageRegistry.addName(CopperIngot, "Copper Ingot");
    	
    	GameRegistry.addRecipe(new ItemStack(CopperOre, 1), new Object[]
    			{
    				"XXX", "XXX","XXX", 'X', Block.func_149684_b("dirt")
    			});
    	
    	GameRegistry.addRecipe(new ItemStack(CopperIngot, 1), new Object[]
    			{
    				"XXX", "XXX","XXX", 'X', CopperOre
    			});
    }
}

 

 

 

CopperOre.java

 

 

package com.test.testmod;

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;
import net.minecraft.creativetab.CreativeTabs;

public class CopperOre extends Block {

public CopperOre(Material par2Material) 
{
	super(par2Material);
	func_149647_a(CreativeTabs.tabBlock);
}

@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister par1IconRegister)
    {
        this.field_149761_L = par1IconRegister.registerIcon("testmod:CopperOre");
    }
}

 

 

 

CopperIngot.java

 

 

package com.test.testmod;

import net.minecraft.item.Item;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;

public class CopperIngot extends Item
{
public CopperIngot(int j)
{
	maxStackSize=j;
	setCreativeTab(CreativeTabs.tabMaterials);
}

@Override
public void registerIcons(IIconRegister par1IconRegister)
    {
        this.itemIcon = par1IconRegister.registerIcon("testmod:CopperIngot");
    }
}

 

 

 

and here's screenshot of path to textures:

http://img835.imageshack.us/img835/9494/m2bt.png

Link to comment
Share on other sites

To me, it looks right.

 

But I haven't used Gradle yet, so there might be some subtle thing I'm not seeing.

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.

Link to comment
Share on other sites

if your 100% sure you have your textures in the correct location then just ignore it for now, then randomly in next restart or something they just mite start working, ive had that issue with textures but im pretty sure its forge gradle workspace derping & not syncing properly

Link to comment
Share on other sites

the problem is you type (IIconRegister par1IconRegister)

it should be IconRegister

 

Oh good catch.

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.

Link to comment
Share on other sites

Dude, look at the source code (tested with Forge 10.12.0.996, may not work with other versions):

Item.class

    public Item setTextureName(String par1Str)
    {
        this.iconString = par1Str;
        return this;
    }

    /**
     * Returns the string associated with this Item's Icon.
     */
    @SideOnly(Side.CLIENT)
    protected String getIconString()
    {
        return this.iconString == null ? "MISSING_ICON_ITEM_" + field_150901_e.func_148757_b(this) + "_" + this.unlocalizedName : this.iconString;
    }

Block.class

    public Block func_149658_d(String p_149658_1_)
    {
        this.field_149768_d = p_149658_1_;
        return this;
    }

    @SideOnly(Side.CLIENT)
    protected String func_149641_N()
    {
        return this.field_149768_d == null ? "MISSING_ICON_BLOCK_" + func_149682_b(this) + "_" + this.field_149770_b : this.field_149768_d;
    }

Before you even think about modding,

Link to comment
Share on other sites

Men, try to reinstall forge like this. http://www.minecraftforge.net/forum/index.php/topic,15314.0.html

Your situation is strange. Try to register in Item's method like this

this.setTextureName("flintstonetools:ItemRifle");

It works for me.

[spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler][spoiler=Spoiler]LOL,Its nothing interesting here

[spoiler=Spoiler]And here too

[spoiler=Spoiler]But that image is pretty good

 

 

 

 

 

 

 

 

 

 

 

 

Link to comment
Share on other sites

here put this into your block class

 

public void func_149651_a(IIconRegister icon)
{
     this.field_149761_L = icon.registerIcon(ModNAME.modid + ":" + this.func_149732_F().substring(5).replace(".name", ""));
}

 

this.func_149732 = getUnlocalizedName()

 

do:

System.out.println(this.func_149732_F().substring(5).replace(".name", ""));

 

it should print out the unlocalized name & thats what your png image should be called

Link to comment
Share on other sites

Where must I put this?

System.out.println(this.func_149732_F().substring(5).replace(".name", ""));

I tried to put it in CopperOre function, but couldn't find this

Also I tried this code in init function:

for (int x = 0; x<10;x++)
    	{
    		System.out.println("lol");
    		System.out.println(CopperOre.func_149732_F().substring(5).replace(".name", ""));
    	}

and searched for "lol" in text editor, but it couldn't find it

Link to comment
Share on other sites

Where must I put this?

System.out.println(this.func_149732_F().substring(5).replace(".name", ""));

I tried to put it in CopperOre function, but couldn't find this

Also I tried this code in init function:

for (int x = 0; x<10;x++)
    	{
    		System.out.println("lol");
    		System.out.println(CopperOre.func_149732_F().substring(5).replace(".name", ""));
    	}

and searched for "lol" in text editor, but it couldn't find it

 

clearly you don't want help anymore ... so Gl

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.