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

Hello MCF forums,

I am making a slab block that has meta data. it appears that the meta data does not work. I also need each meta data to have its own texture.  I have never worked with meta data blocks before so give me a break if this is a nooby question. Please help.

The metadata works.

 

Register your icons, and reference those registered icons in your

getIcon

@Override.

 

To solve the issue of why your metadata isn't working, you're going to have to supply some code, though :)

Normally, I would ask for an error log when you state you are getting an error.

 

However, in this case that won't be necessary.

 

 

I realise you want us to give you a break, and this is in no way meant personally ... but I am sad to say, you are making very basic mistakes in your code, and I suggest following Java Beginner tutorials from the first chapter.

 

As for your code, most of it is coherent. This part has as many very basic errors as it has lines, though:

 

for (int i = 0; i < this.color.length; ++i) {
    this.color[i] = iconRegister.registerIcon(BOW.MODID + ":" + this.getTextureName() + "_" + color[i]);
    this.color[i] = iconRegister.registerIcon(BOW.MODID + ":" + this.getTextureName() + "_" + color[i]);
}

 

  • You perform exactly the same operation twice, with the same result.
  • You assign a new value to a
    final

    (constant) field.

  • You assign the return value of
    IIconRegister#registerIcon

    - which is an object of type

    IIcon

    to a field of type

    String


 

Furthermore,

 

  • You never
    @Override

    any inherited methods

  • You have plenty of
    import

    s you aren't using

  • It is customary to have packages lowercase
  • You never
    @Override

    or even implement

    getIcon


  • You mention metadata not working, but not once do you set, get or use it
  • Your block bounds are off for a slab
  • You inherit from
    Block

    instead of leveraging the more fitting

    BlockSlab

    subclass

 

 

Wherever on the forums you found the code, I suggest you stay away from that source.

 

 

The errors and oversights I have mentioned here should guide you towards making a working Block - a BlockSlab even.

 

Still, the very basic errors that you have failed to find - as well as your inability to parse the (unpasted) error log to solve the issues with the code - indicate that you are not exactly experienced as a programmer.

 

As such, you might have further issues implementing a working Block. In that case, you are more than welcome to reply to this thread, and I will do my best to help and, if time permits, educate.

 

 

I am sincerely sorry for coming off harsh. It was not my intention, but it is late and I cannot be bothered rewriting the post.

 

I wish you the best of luck with your project, and feel free to post further issues for us to scrutinise :)

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.