Stumped, creating blocks with rotation (block faces etc.)

Discussion in 'Plugin Development' started by N1T3SLAY3R, Jul 18, 2014.

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

    N1T3SLAY3R

    Hello, im trying to create blocks (copy paste kind of thing) and then set their rotation afterwards. I am able to save their block face properly, but i can never get the blocks. specifically stairs to work properly. I can easily place them but not rotate them.
    Save part: http://pastebin.com/nh0Mzic4
    (Saves correctly)

    Creating blocks part: http://pastebin.com/L08WcaAR


    When i run the creating blocks i get no errors, but just eastern faced blocks appear

    it is for the development of this plugin http://dev.bukkit.org/bukkit-plugins/empirecraft/, so that the structures can be rotated upon creation etc.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jun 9, 2016
  2. Offline

    fireblast709

  3. Offline

    N1T3SLAY3R

    The older methods have all been deprecated
     
  4. Offline

    fireblast709

    N1T3SLAY3R the non depreciated methods seem to lack a bit in times like this.
     
  5. Offline

    N1T3SLAY3R

    so do they still work? or are they going to be removed soon, in other words why is it depreciated?
     
  6. Offline

    fireblast709

    N1T3SLAY3R it is depreciated because they are so called magic values (the numbers have an abstract meaning). Yet block setting methods still rely on the magic values, which makes it hard to properly switch to MaterialData yet.
     
  7. Offline

    N1T3SLAY3R

    alright, so your recommendation would be to use the data values until this stuff is updated, and then switch to it? But is there any issue with the current code as to why it doesn't switch/no error message (or more confusingly *sometimes* changes the blocks direction (not the right way) depending on height)
     
  8. Offline

    fireblast709

    N1T3SLAY3R try debugging your current code. My first guess is that the loading code doesn't use the same data as the saving code, possibly caused by a bug in either snippets
     
  9. Offline

    N1T3SLAY3R

    it all saves fine, while debugging it saves and receives the data properly, its just trying to set the facing direction does nothing
     
  10. Offline

    Quackster

    I see your problem, here's what I've done, taken out of my own plugin! :)

    Code:
    block.setType(Material.CHEST);
    org.bukkit.material.Chest chest = new org.bukkit.material.Chest(0, block.getData());
    chest.setFacingDirection(this.getFace()); // BlockFace.NORTH example
    block.setData(chest.getData());
    
     
    N1T3SLAY3R likes this.
  11. Offline

    N1T3SLAY3R

    ya that works great, ty only issue is that its still deprecated/magic values so i dont know how long it'll last but ill use it for the time being.
     
    Quackster likes this.
  12. Offline

    Quackster

    I don't know about when they'll be removed but, at this moment in time, there is no other way to do this.
     
Thread Status:
Not open for further replies.

Share This Page