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 searching, on and off, for DAYS for a tutorial on how to make a block.

I've searched this forum and also google, with no luck.

I'm looking for a tutorial for 1.9 using blockstates and not using deprecated methods like registerBlock() or setBlockTextureName().

 

I'm sure there's a tutorial somewhere, right? Anyone know?

  • Author

Hi

 

May the luck was not on your side, but within two seconds of googling I found this:

 

http://modwiki.temporal-reality.com/mw/index.php/Main_Page

 

Happy coding

Sincerely -pick

 

Great, thanks! :D

It might help me with stuff, however looking at the block tutorial, I've already done what's in the tutorial and it's not working. The block is not ingame, neither as /give or in the creative menu (which I have put it in).

 

I do have an item working so I have the basics done and working.

 

My code (simplified) is like:

 

The main class calls proxy stuff. CommonProxy.preInit() calls BlockManager.createBlocks() which does:

[snip...]

GameRegistry.register(clinkerBrickBlock = new ClinkerBricks());

 

and the block class is:

 

[snip imports...]

 

public class ClinkerBricks extends Block{

    public ClinkerBricks() {

        this("clinker_bricks", Material.rock);

    }

 

    public ClinkerBricks(String name, Material material) {

        super(material);

        this.setRegistryName(name);

        this.setUnlocalizedName(this.getRegistryName().toString());

        this.setCreativeTab(CreativeTabs.tabBlock);

    }

}

 

 

That's the correct chain of events to register a block, right?

Registering it twice crashes with "already registered that name" error, so the registering goes through, but it doesn't show up ingame. I don't even care about textures right now, I just wanna see that sweet, sweet black/magenta checker pattern  ;)

This is so basic that I'm embarrased, but I'm not getting it to work  :-[

 

Any thoughts?

  • Author

Did you register an ItemBlock? Because if you don't, your Block can only exist placed down in the world.

 

Ah! I did not do that. Didn't know it was a thing. Looking for tutorials about the relation of blocks and ItemBlock: can't find any xD My google-fu must suck, or are there generally not many detailed tutorials available?

 

I took a shot in the dark: saw something about registering ItemBlock(this) so I threw

GameRegistry.register(new ItemBlock(this), getRegistryName());

into the constructor of my block and it works! :D

 

Textures next! It's going slow but I'm making progress! :D

 

Thansk again!

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.