Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

I've been trying to get custom block textures to work and can't figure it out.

 

Code:

package com.loomhost.ripbandit.randomblocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
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.registry.GameRegistry;

@Mod(modid = RandomBlocks.MODID, version = RandomBlocks.VERSION)
public class RandomBlocks
{
    public static final String MODID = "RandomBlocks";
    public static final String VERSION = "1.0";
    public static Block chainFence;
    public static CreativeTabs RandomBlocks = new CreativeTabs("RandomBlocks")
    {
    public Item getTabIconItem()
    {
    return Items.bed;
    }
    };
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
	//Init message
        System.out.println("Random Blocks V 0.1 is reporting for duty!");
        
        
        //Blocks
        
        //ChainFence
        this.chainFence = new NormalBlock() .setHardness(0.5F) .setResistance(0F) .setBlockName("chainFence") .setCreativeTab(RandomBlocks) .setBlockTextureName("RandomBlocks:chainFence");
        GameRegistry.registerBlock(this.chainFence, this.chainFence.getUnlocalizedName() .substring(5));
        
    }
}

 

Error log:

java.io.FileNotFoundException: randomblocks:textures/blocks/chainFence.png
at net.minecraft.client.resources.SimpleReloadableResourceManager.getResource(SourceFile:58) ~[simpleReloadableResourceManager.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTextureAtlas(TextureMap.java:125) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureMap.loadTexture(TextureMap.java:90) [TextureMap.class:?]
at net.minecraft.client.renderer.texture.TextureManager.loadTexture(SourceFile:72) [TextureManager.class:?]
at net.minecraft.client.renderer.texture.TextureManager.onResourceManagerReload(SourceFile:136) [TextureManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.notifyReloadListeners(SourceFile:104) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.resources.SimpleReloadableResourceManager.reloadResources(SourceFile:92) [simpleReloadableResourceManager.class:?]
at net.minecraft.client.Minecraft.refreshResources(Minecraft.java:568) [Minecraft.class:?]
at cpw.mods.fml.client.FMLClientHandler.finishMinecraftLoading(FMLClientHandler.java:303) [FMLClientHandler.class:?]
at net.minecraft.client.Minecraft.startGame(Minecraft.java:527) [Minecraft.class:?]
at net.minecraft.client.Minecraft.run(Minecraft.java:815) [Minecraft.class:?]
at net.minecraft.client.main.Main.main(SourceFile:103) [Main.class:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.7.0_60]
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[?:1.7.0_60]
at java.lang.reflect.Method.invoke(Unknown Source) ~[?:1.7.0_60]
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:?]

 

Any help is appreciated!

Your file is not there. Java is looking for the file and failing to find it. Where is your file currently?

Notice how your path is RandomBlocks, but its looking for a folder randomblocks. You MUST have your ModID and associated assets folder lowercase.

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Oh wait. Why are your assets not in the resources folder?

 

Try this path:

\src\main\resources\assets\randomblocks\textures\blocks

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Can you give us the file hierarchy and the registration class one more time? Just to make sure we know what we are dealing with.

  • Author

Files are at \src\main\resources\assets\randomblocks.

 

Here is the RandomBlocks class:

package com.loomhost.ripbandit.randomblocks;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
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.registry.GameRegistry;

@Mod(modid = RandomBlocks.MODID, version = RandomBlocks.VERSION)
public class RandomBlocks
{
    public static final String MODID = "randomblocks";
    public static final String VERSION = "1.0";
    public static Block chainFence;
    public static CreativeTabs RandomBlocks = new CreativeTabs("RandomBlocks")
    {
    public Item getTabIconItem()
    {
    return Items.bed;
    }
    };
    
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
	//Init message
        System.out.println("Random Blocks V 0.1 is reporting for duty!");
        
        
        //Blocks
        
        //ChainFence
        this.chainFence = new NormalBlock() .setHardness(0.5F) .setResistance(0F) .setBlockName("chainFence") .setCreativeTab(RandomBlocks) .setBlockTextureName("randomblocks:chainFence");
        GameRegistry.registerBlock(this.chainFence, this.chainFence.getUnlocalizedName() .substring(5));
        
    }
}

And the NormalBlock class:

package com.loomhost.ripbandit.randomblocks;

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

public class NormalBlock extends Block {
public NormalBlock(){
super(Material.ground);
}
}

Since when was there a method called setBlockTextureNam()?? O.o

 

If I'm just old fashioned forge, then ignore this. But I ha have the sneaking suspicion that it could be your problem...

We all stuff up sometimes... But I seem to be at the bottom of that pot.

Assuming you are set up the proper way (unlike me xD I apparently like making it hard on myself) your block png should be at this location:

~devforgeenvironment~\src\main\resources\assets\%modid%\textures\blocks\yourblock.png

In Eclipse, (assuming you are using Eclipse,) you should see:

~projectfolder~
|  src/main/java
|  |  (all your mod .java packages)
|
|  src/main/resources
|  |  assets.modid.textures.blocks
|  |  |  (any block textures)
|  |
|  |  assets.modid.textures.items
|  |  |  (any item textures)
|  |
|  |  assets.modid.lang
|  |  |  (your lang file(s))
|  |
|  |  mcmod.info
|
|  JRE System Library
|  |  (whole bunch of things)
|
|  Referenced Libraries
|  |  (whole bunch of things)
|
|  (whole bunch of other Forge things)

 

I hope that's readable and can help xD

 

===========================

 

Since when was there a method called setBlockTextureNam()?? O.o

 

If I'm just old fashioned forge, then ignore this. But I ha have the sneaking suspicion that it could be your problem...

 

I've been using setBlockTextureName() forever. (I've only used Forge 1.7.4.)  I've never seen setBlockTextureNam() though, but I don't see that in his code either.  I asssume yours was just a careless typo then :D

Maybe you should use register blocks in method with argument "FMLPreInitializationEvent" not in "FMLInitializationEvent"?

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...

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.