Cannot set shape of a rail

Discussion in 'Plugin Development' started by hasunemiku2015, Mar 22, 2020.

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

    hasunemiku2015

    sign.getWorld().getBlockAt(blockx,blocky + 2,blockz);
    Rail r = (Rail) b.getBlockData();

    //Above 2 lines are working (tested with prints already)
    r.setShape(Rail.Shape.NORTH_EAST);


    Why the setShape isnt working?
     
  2. Online

    timtower Administrator Administrator Moderator

  3. Offline

    hasunemiku2015

    what do you mean by "updating the block"
    what do i need to do
     
  4. Online

    timtower Administrator Administrator Moderator

    @hasunemiku2015 There is a way to update them, believe it Block#getState()#update()
     
  5. Offline

    hasunemiku2015

    "updated the block" with b#getState#update(); , no use
     
  6. Online

    timtower Administrator Administrator Moderator

    Does the shape update if you use getters and prints?
     
  7. Offline

    hasunemiku2015

    Code:
    Inital BlockState :
    [16:50:39] [Server thread/INFO]: CraftBlockData{Block{minecraft:rail}[shape=north_west]}
    
    Final BlockState:
    [16:50:39] [Server thread/INFO]: org.bukkit.craftbukkit.v1_15_R1.block.CraftBlockState@ba48f438
     
    Last edited by a moderator: Mar 23, 2020
  8. Online

    timtower Administrator Administrator Moderator

  9. Offline

    hasunemiku2015

    no it did NOT update

    inital state = final state

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
  10. Online

    timtower Administrator Administrator Moderator

  11. Offline

    hasunemiku2015

    yea but i dont know h0w to set block data to a specific shape like north#west the syntax
     
  12. Online

    timtower Administrator Administrator Moderator

    @hasunemiku2015 You have the Rail data already, you just need to apply it to the block again.
     
  13. Offline

    hasunemiku2015

    b#setBlockData #arga# argb#
    what to write in arg a and arg b

    if i want to set the rail to northeast
     
    Last edited: Mar 23, 2020
  14. Online

    timtower Administrator Administrator Moderator

Thread Status:
Not open for further replies.

Share This Page