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

    • I'm using Modrinth as a launcher for a forge modpack on 1.20.1, and can't diagnose the issue on the crash log myself. Have tried repairing the Minecraft instillation as well as removing a few mods that have been problematic for me in the past to no avail. Crash log is below, if any further information is necessary let me know. Thank you! https://paste.ee/p/k6xnS
    • Hey folks. I am working on a custom "Mecha" entity (extended from LivingEntity) that the player builds up from blocks that should get modular stats depending on the used blocks. e.g. depending on what will be used for the legs, the entity will have a different jump strength. However, something unexpected is happening when trying to override a few of LivingEntity's functions and using my new own "Mecha" specific fields: instead of their actual instance-specific value, the default value is used (0f for a float, null for an object...) This is especially strange as when executing with the same entity from a point in the code specific to the mecha entity, the correct value is used. Here are some code snippets to better illustrate what I mean: /* The main Mecha class, cut down for brevity */ public class Mecha extends LivingEntity { protected float jumpMultiplier; //somewhere later during the code when spawning the entity, jumpMultiplier is set to something like 1.5f //changing the access to public didn't help @Override //Overridden from LivingEntity, this function is only used in the jumpFromGround() function, used in the aiStep() function, used in the LivingEntity tick() function protected float getJumpPower() { //something is wrong with this function //for some reason I can't correctly access the fields and methods from the instanciated entity when I am in one of those overridden protected functions. this is very annoying LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 0f return this.jumpMultiplier * super.getJumpPower(); } //The code above does not operate properly. Written as is, the entity will not jump, and adding debug logs shows that when executing the code, the value of this.jumpMultiplier is 0f //in contrast, it will be the correct value when done here: @Override public void tick() { super.tick(); //inherited LivingEntity logic //Custom logic LogUtils.getLogger().info(String.valueOf(this.jumpMultiplier))) //will print 1.5f } } My actual code is slightly different, as the jumpMuliplier is stored in another object (so I am calling "this.legModule.getJumpPower()" instead of the float), but even using a simple float exactly like in the code above didn't help. When running my usual code, the object I try to use is found to be null instead, leading to a crash from a nullPointerException. Here is the stacktrace of said crash: The full code can be viewed here. I have found a workaround in the case of jump strength, but have already found the same problem for another parameter I want to do, and I do not understand why the code is behaving as such, and I would very much like to be able to override those methods as intended - they seemed to work just fine like that for vanilla mobs... Any clues as to what may be happening here?
    • Please delete post. Had not noticed the newest edition for 1.20.6 which resolves the issue.
    • https://paste.ee/p/GTgAV Here's my debug log, I'm on 1.18.2 with forge 40.2.4 and I just want to get it to work!! I cant find any mod names in the error part and I would like some help from the pros!! I have 203 mods at the moment.
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

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