[DEV] Specialized block types

Discussion in 'Bukkit Discussion' started by robhol, Jan 2, 2011.

Thread Status:
Not open for further replies.
  1. Offline


    I think it would be great if some of Minecraft's block types were differentiated a bit in code.
    The concept of block "data" is rather bothersome and cryptic, (and rarely the same for two block types) and overall, it's none too easy to use.

    I'd imagine stuff like redstone wire, mine cart tracks, input stuff (buttons, plates, and especially levers) as classes. They'd obviously inherit from the standard Block class, but would provide more specialized access to the individual types of blocks. For example, redstone wire could have a Level member for easy access. (And prettier code, which is always a plus.)
    Tracks (and RS wire) could expose ways to get and set direction. Levers could provide get/setState to get or set whether the lever is "thrown" and is providing power. Maybe some cool stuff involving the "liquid types", if this is even possible. :p

    All in all, this works a little like the ComplexBlock types in hMod. These are all accomplishable using block data, but this seems a bit like unnecessary complication for the developer. In my humble opinion, a great mod should allow developers to "forget" about unnecessarily complicated details, and focus on making great scripts! :) Seeing as you're already focusing on ease of use, this seems to be right down your alley, am I right?

    Any thoughts on this?
  2. Offline


    That should actually be really easy to do, like with crops and saplings. I know there are certain things that I would like to mess around with that I can't with just the block.get/setData() stuff, like redstone charge, that I'd like to see them implement. Unfortunately that stuff would be a little harder because it's not in the block data integer.
  3. Offline


    It actually is the block data integer. I was wondering about that too when coding hMod plugins, but it turns out a function was actually broken, and so didn't yield.. well, anything. Another similar function did, though.

    As for this, yes, it's probably not a major challenge. It's mostly a wrapper around known functionality, but if it makes people's lives easier, that's all the more reason for it, I should think. :)
  4. Offline


    While nice, that is a lot of short-lived Java objects that would be created, so it may not be the best idea. *All* data, sans perhaps furnaces, have been accessible in hMod, Redstone wire charge included (charge is data).

    I might add some utility classes to Bukkit though, which abstracts a lot of this.
  5. Offline


    Could also just have the functions as... something static, I guess, that would resolve the "lots of objects" problem even if it doesn't look as sweet.
Thread Status:
Not open for further replies.

Share This Page