Jump to content

[1.7.10] Multi texture Block


drok0920

Recommended Posts

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.

Link to comment
Share on other sites

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 :)

Link to comment
Share on other sites

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.