Posted June 24, 201411 yr 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!
June 24, 201411 yr Your file is not there. Java is looking for the file and failing to find it. Where is your file currently? http://i1279.photobucket.com/albums/y523/textcraft/Jun%202014%20-%202/a77dd69ddfa9e622422c5e5cd7e377b14d5cdedec1b7a8e19dde68c9e22be6dfbf81219d3893f419da39a3ee5e6b4b0d3255bfef95601890afd8070929aa338b0dfc68d48355_zps0c847cf3.png[/img] I have a reputation for text walls. If you ask me a question I will most likely explain it in the most wordy way possible. -0 characters left
June 24, 201411 yr Author Block is in \src\main\java\assets\RandomBlocks\textures\blocks. Name is chainFence.png.
June 24, 201411 yr 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.
June 24, 201411 yr 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.
June 24, 201411 yr 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. http://i1279.photobucket.com/albums/y523/textcraft/Jun%202014%20-%202/a77dd69ddfa9e622422c5e5cd7e377b14d5cdedec1b7a8e19dde68c9e22be6dfbf81219d3893f419da39a3ee5e6b4b0d3255bfef95601890afd8070929aa338b0dfc68d48355_zps0c847cf3.png[/img] I have a reputation for text walls. If you ask me a question I will most likely explain it in the most wordy way possible. -0 characters left
June 24, 201411 yr 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); } }
June 24, 201411 yr What IDE are you using? you need to make sure the resources folder is marked as "Sources" or it wont be loaded when you run your project. I am the author of Draconic Evolution
June 24, 201411 yr Since when was there a method called setBlockTextureNam()?? 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.
June 24, 201411 yr Assuming you are set up the proper way (unlike me 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 =========================== Since when was there a method called setBlockTextureNam()?? 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 http://i1279.photobucket.com/albums/y523/textcraft/Jun%202014%20-%202/a77dd69ddfa9e622422c5e5cd7e377b14d5cdedec1b7a8e19dde68c9e22be6dfbf81219d3893f419da39a3ee5e6b4b0d3255bfef95601890afd8070929aa338b0dfc68d48355_zps0c847cf3.png[/img] I have a reputation for text walls. If you ask me a question I will most likely explain it in the most wordy way possible. -0 characters left
June 24, 201411 yr Maybe you should use register blocks in method with argument "FMLPreInitializationEvent" not in "FMLInitializationEvent"?
June 24, 201411 yr Author Fixed by moving to FMLPreInitializationEvent and making packages instead of folders.
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.