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'm learning how to make mods, I have a bit of Java knowledge. I'm trying to give my block "block1" and item "item1" a texture, I have made 2 .png files using paint.net.

 

This is my code:

learning.java: http://pastebin.com/9E7cN0Ur

Block1.java: http://pastebin.com/4nA0zAqX

Package explorer:

 

Texures:

block1.png:

item1.png:

 

Log file: http://pastebin.com/AxxwjUgF

Forge version: forge-1.7.2-10.12.2.1.21

 

I don't know why my textures don't work, in-game they have the purple-black "missing texture". Can anyone help me?

                block1.setBlockTextureName(MODID + ":" + "block1.png"); 

 

if you add .PNG at the end of the name it try to find MODID/textures/blocks/block1.png.png

 

                block1.setBlockTextureName(MODID + ":block1"); 

 

try this. And if this isn't work try this;

                block1.setBlockTextureName("block1"); 

 

and add block1.java

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister reg) {
	this.blockIcon = reg.registerIcon(learning.MODID + ":" + this.getTextureName());
}

 

Or also you can use my addBlock function

 

import cpw.mods.fml.common.registry.GameRegistry;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.extend.mod.ref;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item.ToolMaterial;
import net.minecraft.util.IIcon;

public class addblock extends Block {
public addblock(String name, Material material, SoundType sound, float hardness, String item, int level) {
	super(material);

	this.setHardness(hardness);
	this.setStepSound(sound);
	this.setCreativeTab(CreativeTabs.tabBlock);
	this.setBlockName(name);
	this.setBlockTextureName(name);
	this.setHarvestLevel(item, level);
	GameRegistry.registerBlock(this, name);
}

@SideOnly(Side.CLIENT)
@Override
public void registerBlockIcons(IIconRegister reg) {
	this.blockIcon = reg.registerIcon(ref.uid + ":" + this.getTextureName());
}
}

 

when you register;

public static Block blackDiamondOre;
public static Block blackDiamondBlock;

this.blackDiamondBlock = new addblock("blackdiamondblock", Material.iron, Block.soundTypeStone, 2.0F, "pickaxe", 2);
       	this.blackDiamondOre = new addore("blackdiamondore", Block.soundTypeStone, 4.0F, "pickaxe", 2);

I know they are same but I write sometime different thinks and I have you use registerBlockIcons but you don't need

Minecraft is case-sensitive, so either change your modid to mymod (all lowercase), or the assets directory to assets/MyMod/.

Check out my mod, Realms of Chaos, here.

 

If I helped you, be sure to press the "Thank You" button!

  • Author

It works!

MODID.toLowerCase()

and fixing"texures" to "textures" did the trick!

 

Thanks everyone for helping me!

  • Author

About the Package explorer structure, why does it works in this video:

?

 

And where do I have to put my language files?

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.