Jump to content

[1.7.2] I need help with my texturing, It's not working


kennybenny

Recommended Posts

Hello, I need help with my texturing, when test run it just shows the untextured texture.

 

 

Here is my main file's code:

 

package k3.moreMetals;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
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.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;


@Mod(modid = moreMetalsMod.MODID, version = moreMetalsMod.VERSION)
public class moreMetalsMod {

public static final String MODID = "moreMetals";
public static final String VERSION = "1.0";

public static Block orePlatinum;
public static Item chunkPlatinum;

public static CreativeTabs moreMetalsTab = new CreativeTabs("moreMetalsStuff"){

@Override
	public Item getTabIconItem() {
		return Items.emerald;
	} 
};

@EventHandler
public void preInit(FMLPreInitializationEvent preevent){

	chunkPlatinum = new Item().setUnlocalizedName("chunkPlatinum").setCreativeTab(moreMetalsTab).setTextureName(MODID + ":" + "chunkPlatinum");
	GameRegistry.registerItem(chunkPlatinum, "chunkPlatinum");

	orePlatinum = new BlockPlatOre().setBlockName("orePlatinum").setCreativeTab(moreMetalsTab).setBlockTextureName(MODID + ":" + "orePlatinum");
	GameRegistry.registerBlock(orePlatinum, "orePlatinum");
}

@EventHandler
public void init(FMLInitializationEvent event){

}
}

 

 

here's the BlockPlatOre code:

 

package k3.moreMetals;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public class BlockPlatOre extends Block {

public BlockPlatOre() {
	super(Material.iron);

}

}

 

 

 

 

the orePlatinum texture is  in assets.moreMetals.textures.blocks and the chunkPlatinum is in assets.moreMetals.textures.items. Also, the images are png files.

Currently developing the More Metals Mod.

Link to comment
Share on other sites

Try setting the texutre name under the 'super' constructor, and not in the preInit. It would also be nice to do the same thing with your creative tab... Your block class should look like this:

 

 

 

package k3.moreMetals;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public class BlockPlatOre extends Block {

public BlockPlatOre() {
	super(Material.iron);
                this.setBlockTextureName(MODID + ":" + "orePlatinum");
                this.setCreativeTab(moreMetalsTab);

}

}

 

If i helped you, please click the "thank you" button :)

Link to comment
Share on other sites

Try setting the texutre name under the 'super' constructor, and not in the preInit. It would also be nice to do the same thing with your creative tab... Your block class should look like this:

 

 

 

package k3.moreMetals;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public class BlockPlatOre extends Block {

public BlockPlatOre() {
	super(Material.iron);
                this.setBlockTextureName(MODID + ":" + "orePlatinum");
                this.setCreativeTab(moreMetalsTab);

}

}

 

 

 

Okay, now it's giving me the errors "MODID cannot be resolved to a variable" and "moreMetalsTab cannot be resolved to a variable" Do you know how to fix that?

Currently developing the More Metals Mod.

Link to comment
Share on other sites

You need to import the class moreMetalsMod! Then you do this:

 

package k3.moreMetals;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import blablabla.moreMetalsMod; //Please do ask why blablabla.moreMetalsMod doens't work!

public class BlockPlatOre extends Block {

public BlockPlatOre() {
	super(Material.iron);
                this.setBlockTextureName(moreMetalsMod.MODID + ":" + "orePlatinum");

}

}

 

And leave the Creative tab in the preInit...

Thanks :)

João Fernandes

Link to comment
Share on other sites

You need to import the class moreMetalsMod! Then you do this:

 

package k3.moreMetals;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import blablabla.moreMetalsMod; //Please do ask why blablabla.moreMetalsMod doens't work!

public class BlockPlatOre extends Block {

public BlockPlatOre() {
	super(Material.iron);
                this.setBlockTextureName(moreMetalsMod.MODID + ":" + "orePlatinum");

}

}

 

And leave the Creative tab in the preInit...

 

Well now the block isn't showing up in the creative tab when I test it, do you know why?

Currently developing the More Metals Mod.

Link to comment
Share on other sites

By MODID i meant your actual mod id, which i think is moremetals, idk... but, if can also do as jtmnf said, to prevent typing erros...

As for the creative tab, thats because you have to take it off of the preInit and put it in the 'super' constructor, as i said...

 

If i helped you, please click the "thank you" button :)

Link to comment
Share on other sites

Rokuw, do you mean:

 

(...)
	orePlatinum = new BlockPlatOre().setBlockName("orePlatinum").setBlockTextureName(MODID + ":" + "orePlatinum");
	GameRegistry.registerBlock(orePlatinum, "orePlatinum");
(...)

 

and

 

public class BlockPlatOre extends Block {

public BlockPlatOre() {
	super(Material.iron);
                this.setBlockTextureName(moreMetalsMod.MODID + ":" + "orePlatinum");
                this.setCreativeTab(moreMetalsMod.moreMetalsTab);
}	
}

 

This?

Thanks :)

João Fernandes

Link to comment
Share on other sites

The second one is right, but the first one is supposed to be like this:

 

(...)
	orePlatinum = new BlockPlatOre().setBlockName("orePlatinum");
	GameRegistry.registerBlock(orePlatinum, "orePlatinum");
(...)

(no set block texture name)

 

I hope it works this way :)

If i helped you, please click the "thank you" button :)

Link to comment
Share on other sites

Rsrsrs, thats fine, i always make something like that too :P

 

So anyways, Kennybenny, your block class should look like this:

 

 

package k3.moreMetals;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;

public class BlockPlatOre extends Block {

public BlockPlatOre() {
	super(Material.iron);
                this.setBlockTextureName(moreMetalsMod.MODID + ":" + "orePlatinum");
                this.setCreativeTab(moreMetalsMod.moreMetalsTab);

}

}

 

 

And your main class should look like this:

 

 

package k3.moreMetals;

import net.minecraft.block.Block;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
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.event.FMLPreInitializationEvent;
import cpw.mods.fml.common.registry.GameRegistry;


@Mod(modid = moreMetalsMod.MODID, version = moreMetalsMod.VERSION)
public class moreMetalsMod {

public static final String MODID = "moreMetals";
public static final String VERSION = "1.0";

public static Block orePlatinum;
public static Item chunkPlatinum;

public static CreativeTabs moreMetalsTab = new CreativeTabs("moreMetalsStuff"){

@Override
	public Item getTabIconItem() {
		return Items.emerald;
	} 
};

@EventHandler
public void preInit(FMLPreInitializationEvent preevent){

	chunkPlatinum = new Item().setUnlocalizedName("chunkPlatinum")
	GameRegistry.registerItem(chunkPlatinum, "chunkPlatinum");

	orePlatinum = new BlockPlatOre().setBlockName("orePlatinum");
	GameRegistry.registerBlock(orePlatinum, "orePlatinum");
}

@EventHandler
public void init(FMLInitializationEvent event){

}
}

Also, as you're not using fml init, you can just delete it, but that's up to you, since it makes no difference...

 

I also noticed that you have an item called 'chunkPlatinum' and i bet that its texture isn't working aswell (i think you mentioned it, i don't remember)... I already fixed it in the preInit, just don't forget to set the texture name and creative tab in the 'super' method....

If i helped you, please click the "thank you" button :)

Link to comment
Share on other sites

The second one is right, but the first one is supposed to be like this:

 

(...)
	orePlatinum = new BlockPlatOre().setBlockName("orePlatinum");
	GameRegistry.registerBlock(orePlatinum, "orePlatinum");
(...)

(no set block texture name)

 

I hope it works this way :)

 

Nope, still not working, just a checkered purple and black block, the images are 16x16, just saying, it might help.

Currently developing the More Metals Mod.

Link to comment
Share on other sites

Did you set the texture name in your block class as it is in my spoiler tag?

(if you don't know, just click the 'hidden' button and you'll see the code that works)

If i helped you, please click the "thank you" button :)

Link to comment
Share on other sites

Did you set the texture name in your block class as it is in my spoiler tag?

(if you don't know, just click the 'hidden' button and you'll see the code that works)

 

Yeah, I copy-pasted it all. I'll take some screenshots and if somebody can tell me how to use the insert image thing on the forum (I'm a big noob on the forum) then I can post them.

Currently developing the More Metals Mod.

Link to comment
Share on other sites

I could post my code, but i use internal classes, and you're using public ones, and that would confuse you, i think.... If you want so, just say...

 

As for your problem, could you post your "new" classes, please?

If i helped you, please click the "thank you" button :)

Link to comment
Share on other sites

I'm not tracking the error there :\ Tomorrow I'll see with other eyes if the error wasn't founded yet!

I'll check during the day what kind of problems might cause that... For now I'm not really seeing what's wrong :\

Thanks :)

João Fernandes

Link to comment
Share on other sites

This is my code (I'll only paste the important ones):

 

MainClass

 

public class MainClass
{
    public static final String MODID = "techmodcraft";
    public static final String VERSION = "1.0";

    public static CreativeTabs testTab = new CreativeTabs("techmodcraft") {
        @Override
public Item getTabIconItem() {
	return Items.diamond;
}
    };

    public static Block blockTest;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event){
    	blockTest = new BlockTech().setBlockName("blockTest").setCreativeTab(testTab);
    	GameRegistry.registerBlock(blockTest, "blockTest");
    }

 

BlockTech

 

public class BlockTech extends Block{

public BlockTech() {
	super(Material.rock);
	this.setBlockTextureName(MainClass.MODID + ":" + "blockTest");
}
}

 

In the Package Explorer I have:

- Forge > src/TechModCraft:

    > assets.techmodcraft.textures.blocks > (this has the images of blocks)

    > net.techmodcraft.mod.block > (this has the .java classes)

 

If you don't find any error by comparing with my setup, try to re-create the project... That might help!

 

I'll continue to see this...

Thanks :)

João Fernandes

Link to comment
Share on other sites

This is my code (I'll only paste the important ones):

 

MainClass

 

public class MainClass
{
    public static final String MODID = "techmodcraft";
    public static final String VERSION = "1.0";

    public static CreativeTabs testTab = new CreativeTabs("techmodcraft") {
        @Override
public Item getTabIconItem() {
	return Items.diamond;
}
    };

    public static Block blockTest;
    
    @EventHandler
    public void preInit(FMLPreInitializationEvent event){
    	blockTest = new BlockTech().setBlockName("blockTest").setCreativeTab(testTab);
    	GameRegistry.registerBlock(blockTest, "blockTest");
    }

 

BlockTech

 

public class BlockTech extends Block{

public BlockTech() {
	super(Material.rock);
	this.setBlockTextureName(MainClass.MODID + ":" + "blockTest");
}
}

 

In the Package Explorer I have:

- Forge > src/TechModCraft:

    > assets.techmodcraft.textures.blocks > (this has the images of blocks)

    > net.techmodcraft.mod.block > (this has the .java classes)

 

If you don't find any error by comparing with my setup, try to re-create the project... That might help!

 

I'll continue to see this...

 

 

It's still not working, do you have any tutorials that are any different from what I was already doing?

 

Currently developing the More Metals Mod.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • For the HoneyBottleItem class, would I just copy/paste my Lemon Juice item into the class or would I have to make other changes? Also, for what you first said, I have copied the "getEatingSound" and the "getDrinkingSound" from the class into my ModFoods class (I could link the whole class if that would help you understand more), though nothing seems to have been done. I also do not see a way to prevent particles from appearing when the item is drank. (Could you also post some examples if possible, that would be a great help to see where I went wrong).   I am at a point where I am quite clueless as the tutorials on YouTube do not cover the area I am needing to go into. I do hope that this is not too much of a bother for you. 
    • "An unexpected problem occurred and the game crashed" "Exit code: 1" I don't know what to do. Please help
    • https://mclo.gs/iVJZfGm https://privatebin.net/?442243857e9dcaca#5MhV8JAuhNJnN587jbG2pcVQi8VnvgAVafmpAd6Gnv91
    • So im making a mod for minecraft and i want to add custom fishing rods... aka fishing rods with different bait, depending on the bait you can have a higher chance of getting other fish. I want to make basically custom fishing rods with at least one custom loot table for each (so that i can choose which fish have a higher chance of being caught in a simpler way with said loot table) Problem is i dont know even where to start with doing this, like at all. Im very beginner with modding minecraft, any help (links to any source which could help me with this is also very helpful) would be great. 1.20 forge(of course)
    • Hi, my name is Gatis. Mostly all I do is play minecraft on Hypixel server. I play Skyblock where almost every player has installed QOL mods. They are nice and work nice but recently the grind I'm on requires not wasting time on boosts and if I'm watching something I usually miss it. Let me explain better. So there is "Mining speed boost" when it's ready message appears in chat. Mod I've been using allows to copy chat message, paste it in mod and next time same message appears it flashes big notification message on screen that speed boost is ready. The thing is somehow I still miss the notification. SO, I want to create mod that can detect that message and make more noticable notification (ex. bigger) or even stop me from moving for 10 sec if I don't use it instantly. I have no knowledge about java I have prepared intellij with forge on 1.8.9 I'm just left with this:                 package com.example.examplemod;                  import net.minecraft.init.Blocks;                import net.minecraftforge.fml.common.Mod;                import net.minecraftforge.fml.common.Mod.EventHandler;                import net.minecraftforge.fml.common.event.FMLInitializationEvent;                 @Mod(modid = ExampleMod.MODID, version = ExampleMod.VERSION)               public class GatisMOD              {                           public static final String MODID = "GatisMOD"; \                           public static final String VERSION = "1.0";                            @EventHandler                          public void init(FMLInitializationEvent event)                          {                                      // some example code                                      System.out.println("DIRT BLOCK >> "+Blocks.dirt.getUnlocalizedName());                          } }     I've watched many video, mostly they show how to setup everything but how to create, prepare file and later (export I guess) export to import in mods folder to use they don't I'd appreciate any help, maybe someone would explain some things to me. In future I have plans to make other feature but I guess not for now.
  • Topics

×
×
  • Create New...

Important Information

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