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

Okay, so i am having troubles with adding in a texture for my block.

This is the code i have for the block:

package com.pavelow.main;

import com.pavelow.lib.RefStrings;

import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;

public class PavelowOre extends Block {

public PavelowOre (Material material) 
    {
            super(material);
            setUnlocalizedName("PavelowOre");
            setHardness(4.0f);
            setStepSound(Block.soundTypeStone);
            setCreativeTab(CreativeTabs.tabBlock);
            setHarvestLevel("pickaxe",3);
    }

And that works i guess but i think the problem comes down to the main file:

@Mod(modid = RefStrings.MODID , name = RefStrings.NAME, version = RefStrings.VERSION)
public class mainRegistry {
@SidedProxy(clientSide = RefStrings.CLIENTSiDE , serverSide = RefStrings.SERVERSIDE) 
public static ServerProxy proxy;
public final static Block PavelowOre = new PavelowOre(Material.rock);
@EventHandler
public static void PreLoad(FMLPreInitializationEvent PreEvent) {
	proxy.registerRenderInfo();
	GameRegistry.registerBlock(PavelowOre, "PavelowOre");
}

@EventHandler
public static void Load(FMLInitializationEvent event) {
	if(event.getSide() == Side.CLIENT)
    	{
		Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(Item.getItemFromBlock(PavelowOre), 0, new ModelResourceLocation(RefStrings.MODID + ":" + PavelowOre.getUnlocalizedName().substring(5), "inventory"));
    	}

I have the json files all in the right place and have the right things in it, but i again i think the problem lies in the main files.

1. Make use of proxies! Don't EVER do this: if(event.getSide() == Side.CLIENT)

2.

proxy.registerRenderInfo();
GameRegistry.registerBlock(PavelowOre, "PavelowOre");

You can't be registering renderers before you register item/block. Also - adding renderers should happen in init().

 

http://www.minecraftforge.net/forum/index.php/topic,26267.0.html

Have look here.

1.7.10 is no longer supported by forge, you are on your own.

  • Author

Okay so i added the rendering thing to ClientProxy:

public class ClientProxy extends ServerProxy{
public void registerRenderInfo() {
	Item PavelowOre = GameRegistry.findItem("pavelow", "PavelowOre");
	ModelResourceLocation itemModelResourceLocation = new ModelResourceLocation("pavelow:PavelowOre", "inventory");
    final int DEFAULT_ITEM_SUBTYPE = 0;
    Minecraft.getMinecraft().getRenderItem().getItemModelMesher().register(PavelowOre, DEFAULT_ITEM_SUBTYPE, itemModelResourceLocation);
}
}

And add proxy.registerRenderInfo() to Init but i still get an error when i start up Minecraft.

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.