Jump to content

Recommended Posts

Posted

Hi all. I've got a problem with some missing textures. The thing is: minecraft changes the path of my mod while trying to load a texture block. It works for items, but not for blocks.

Example:

For items i have this path: .../assets/dwarvendrills/textures/items/cobblestoneDrill.png

and i get:

    dwarvendrills:textures/items/cobblestoneDrill.png

For blocks i have: .../assets/dwarvendrills/textures/blocks/apprenticeMiner.png

and i get:

    minecraft:textures/blocks/apprenticeMiner.png  <--- which leads to a file not found exception, changing it for the purple-black texture.

 

The directory structure is as follows:

..

|_ src

    |_  dwarvendrills

      |_  assets

          |_dwarvendrills

              |_lang

              |_models

              |_sounds

              |_textures

                  |_blocks

                      |_apprenticeMiner.png

                  |_items

                      |_cobblestoneDrill.png

      |_  net

      |_  mcmod.info

 

i have a Reference class which has the modid as a constant:

public static final String MOD_ID = "dwarvendrills";

 

in the same package, i've got a Texture class with another constant:

public class final String RESOURCE_PREFIX = Reference.MOD_ID.toLowerCase() + ":";

 

Now, i have a generic class that registers the icon for the items:

ItemsDD

 

 

package net.dwarvendrills.mod.itemdd;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.dwarvendrills.mod.references.Reference;

import net.dwarvendrills.mod.references.Textures;

import net.minecraft.client.renderer.texture.IIconRegister;

import net.minecraft.item.Item;

import net.minecraft.item.ItemStack;

 

public class ItemDD extends Item

{

public ItemDD()

{

super();

}

 

@Override

public String getUnlocalizedName()

{

return String.format("item.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));

}

 

@Override

public String getUnlocalizedName(ItemStack itemStack)

{

return String.format("item.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));

}

 

@Override

@SideOnly(Side.CLIENT)

public void registerIcons(IIconRegister iconRegister)

{

itemIcon = iconRegister.registerIcon(this.getUnlocalizedName().substring(this.getUnlocalizedName().indexOf(".") + 1));

}

 

protected String getUnwrappedUnlocalizedName(String unlocalizedName)

{

return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);

}

}

 

 

 

and another one for blocks, which is pretty much a copy of ItemsDD:

BlocksDD

 

 

 

package net.dwarvendrills.mod.blockdd;

 

import cpw.mods.fml.relauncher.Side;

import cpw.mods.fml.relauncher.SideOnly;

import net.dwarvendrills.mod.references.Textures;

import net.minecraft.block.Block;

import net.minecraft.block.material.Material;

import net.minecraft.client.renderer.texture.IIconRegister;

 

public class BlockDD extends Block

{

 

public BlockDD(Material material)

{

super(material);

 

}

 

public BlockDD()

{

this(Material.iron);

}

 

@Override

public String getUnlocalizedName()

{

return String.format("tile.%s%s", Textures.RESOURCE_PREFIX, getUnwrappedUnlocalizedName(super.getUnlocalizedName()));

}

 

@Override

@SideOnly(Side.CLIENT)

public void registerBlockIcons(IIconRegister iconRegister)

{

blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(super.getUnlocalizedName())));

}

 

 

protected String getUnwrappedUnlocalizedName(String unlocalizedName)

{

return unlocalizedName.substring(unlocalizedName.indexOf(".") + 1);

}

 

}

 

 

 

I know there are other methods to set the texure, like setTextureName() or something like that, but this one should work, 'cause i've seen it working properly.

 

 

Then we have the ApprenticeBlock class:

 

 

package net.dwarvendrills.mod.blockdd;

 

public class ApprenticeMiner extends BlockDD

{

public ApprenticeMiner()

{

super();

this.setBlockName("apprenticeMiner");

}

}

 

 

 

Of course, the blocks and items are intialized and registered accordingly.

 

I've tried to debug minecraft step by step with eclipse. I've seen that, at first, it stablishes the domain correctly "dwarvendrills", and, in fact, the texture of the "cobblestone drill" item works fine, but when it tries to load the block's texture the domain resets, or falls back to "minecraft" at some unknown point.

 

 

[17:35:18] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/blocks/apprenticeMiner.png

java.io.FileNotFoundException: minecraft:textures/blocks/apprenticeMiner.png

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTickableTexture(TextureManager.java:71) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTextureMap(TextureManager.java:58) [TextureManager.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:592) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:941) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at GradleStart.bounce(GradleStart.java:108) [start/:?]

at GradleStart.startClient(GradleStart.java:101) [start/:?]

at GradleStart.main(GradleStart.java:56) [start/:?]

[17:35:18] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

[17:35:18] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[17:35:18] [Client thread/INFO] [Dwarven Drills]: Initialization Complete!

[17:35:19] [Client thread/INFO] [Dwarven Drills]: Post Initialization Complete!

[17:35:19] [Client thread/INFO] [FML]: Forge Mod Loader has successfully loaded 4 mods

[17:35:19] [Client thread/INFO]: Reloading ResourceManager: Default, FMLFileResourcePack:Forge Mod Loader, FMLFileResourcePack:Minecraft Forge, FMLFileResourcePack:Dwarven Drills

[17:35:19] [Client thread/INFO]: Created: 256x256 textures/items-atlas

[17:35:19] [Client thread/ERROR]: Using missing texture, unable to load minecraft:textures/blocks/apprenticeMiner.png

java.io.FileNotFoundException: minecraft:textures/blocks/apprenticeMiner.png

at net.minecraft.client.resources.FallbackResourceManager.getResource(FallbackResourceManager.java:65) ~[FallbackResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SimpleReloadableResourceManager.java:67) ~[simpleReloadableResourceManager.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:126) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:91) [TextureMap.class:?]

at net.minecraft.client.renderer.texture.TextureManager.loadTexture(TextureManager.java:89) [TextureManager.class:?]

at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(TextureManager.java:170) [TextureManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SimpleReloadableResourceManager.java:134) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SimpleReloadableResourceManager.java:118) [simpleReloadableResourceManager.class:?]

at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:653) [Minecraft.class:?]

at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?]

at net.minecraft.client.Minecraft.startGame(Minecraft.java:596) [Minecraft.class:?]

at net.minecraft.client.Minecraft.run(Minecraft.java:941) [Minecraft.class:?]

at net.minecraft.client.main.Main.main(Main.java:164) [Main.class:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at net.minecraft.launchwrapper.Launch.launch(Launch.java:134) [launchwrapper-1.9.jar:?]

at net.minecraft.launchwrapper.Launch.main(Launch.java:28) [launchwrapper-1.9.jar:?]

at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_45]

at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_45]

at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_45]

at GradleStart.bounce(GradleStart.java:108) [start/:?]

at GradleStart.startClient(GradleStart.java:101) [start/:?]

at GradleStart.main(GradleStart.java:56) [start/:?]

[17:35:19] [Client thread/INFO]: Created: 512x256 textures/blocks-atlas

 

 

 

So i hope you guys can help me to figured out where's the problem; that would be very nice. ^^

 

BTW: i don't think capitalization is the problem here, since i've only used it in class names and in second words of png files and unlocalized names, and since i've copy unlocalized names and pasted it in the png files, like pretty much every other name, i don't think is a misspelling issue.

 

If you need more information, please do tell me.

 

Forge Version: 1.7.10-10.13.0.1180

Posted

At first, i tried to put everything where the example mod was (main/java, /main/resources), just by common sense, but then i noticed that eclipse wasn't showing me the import errors or so i thought , so i decided to create a separate project.

 

Oh, well, i guess i should've been more patient; I'll try again.

 

And thank you very much, sir, for your time and your response!

 

Though i'm still wondering why the item texture worked perfectly well but the block one didn't.

 

Cheers!

Posted

Ok, I fixed it!

 

It turns out the file structure wasn't the problem (although i'll stick to the "one mod, one project" thing, just to avoid future issues), but my dumbness. I'll explain it, just in case someone else does the same mistake.

 

In the BlockDD class i wrote:

 

 

      @Override

      @SideOnly(Side.CLIENT)

      public void registerBlockIcons(IIconRegister iconRegister)

      {

        blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(super.getUnlocalizedName())));

      }

     

 

 

 

I should have used:

 

 

      @Override

      @SideOnly(Side.CLIENT)

      public void registerBlockIcons(IIconRegister iconRegister)

      {

        blockIcon = iconRegister.registerIcon(String.format("%s", getUnwrappedUnlocalizedName(this.getUnlocalizedName())));

      }   

 

 

 

Why do i did this? Because i copied the return statement from the getUnlocalizedName method and forgot to change that bit. Getting funny things like this one, from the forge log:

 

 

[13:43:24] [Client thread/TRACE] [FML/dwarvendrills]: Registry add: dwarvendrills:cobblestoneDrill 4096 net.dwarvendrills.mod.itemdd.CobblestoneDrill@3856c94c (req. id -1)

[13:43:24] [Client thread/TRACE] [FML/dwarvendrills]: Registry add: dwarvendrills:apprenticeMiner 165 net.dwarvendrills.mod.blockdd.ApprenticeMiner@211a5528 (req. id -1)

[13:43:24] [Client thread/DEBUG] [FML/dwarvendrills]: Found matching Block net.dwarvendrills.mod.blockdd.ApprenticeMiner@211a5528 for ItemBlock net.minecraft.item.ItemBlock@47ccc612 at id 165, original id requested: -1

[13:43:24] [Client thread/TRACE] [FML/dwarvendrills]: Registry add: dwarvendrills:apprenticeMiner 165 net.minecraft.item.ItemBlock@47ccc612 (req. id 165)

 

 

Which i believe it was causing the "weird domain change".

 

So, yeah, gg for me and remember: be very careful when copy/pasting.

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.