Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.19 KB | None | 0 0
  1. import:
  2. # org.bukkit.block
  3. org.bukkit.util.BoundingBox
  4. net.minecraft.server.v1_13_R2.EnumDirection$EnumAxis
  5. net.minecraft.server.v1_13_R2.Block
  6. net.minecraft.server.v1_13_R2.BlockPosition
  7. net.minecraft.server.v1_13_R2.IBlockData
  8. net.minecraft.server.v1_13_R2.IBlockAccess
  9.  
  10. org.bukkit.block.data.Bisected$Half
  11. org.bukkit.block.BlockFace
  12. org.bukkit.block.data.type.Stairs$Shape
  13.  
  14. function getStairAABB(b: block) :: objects:
  15.  
  16. {_b}.toString() contains "stair"
  17.  
  18. set {_v} to {_b}.getLocation().toVector()
  19.  
  20. set {_data} to {_b}.getBlockData()
  21. set {_bi} to {_data}.getHalf()
  22. set {_face} to {_data}.getFacing().getOppositeFace()
  23. set {_shape} to {_data}.getShape()
  24.  
  25. if {_face} = BlockFace.NORTH!:
  26.  
  27. if {_shape} = Shape.STRAIGHT!:
  28. set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
  29. else if {_shape} = Shape.INNER_LEFT!:
  30. set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
  31. set {_eigth} to (new BoundingBox(0.5, 0.5, 0, 1, 1, 0.5))
  32. else if {_shape} = Shape.INNER_RIGHT!:
  33. set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
  34. set {_eigth} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 0.5))
  35. else if {_shape} = Shape.OUTER_LEFT!:
  36. set {_eigth} to (new BoundingBox(0.5, 0.5, 0.5, 1, 1, 1))
  37. else if {_shape} = Shape.OUTER_RIGHT!:
  38. set {_eigth} to (new BoundingBox(0, 0.5, 0.5, 0.5, 1, 1))
  39.  
  40. else if {_face} = BlockFace.EAST!:
  41.  
  42. if {_shape} = Shape.STRAIGHT!:
  43. set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
  44. else if {_shape} = Shape.INNER_LEFT!:
  45. set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
  46. set {_eigth} to (new BoundingBox(0.5, 0.5, 0, 1, 1, 0.5))
  47. else if {_shape} = Shape.INNER_RIGHT!:
  48. set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
  49. set {_eigth} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 0.5))
  50. else if {_shape} = Shape.OUTER_LEFT!:
  51. set {_eigth} to (new BoundingBox(0.5, 0.5, 0.5, 1, 1, 1))
  52. else if {_shape} = Shape.OUTER_RIGHT!:
  53. set {_eigth} to (new BoundingBox(0, 0.5, 0.5, 0.5, 1, 1))
  54.  
  55. # if {_shape} = Shape.STRAIGHT!:
  56.  
  57. # if {_face} = BlockFace.NORTH!:
  58. # set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
  59. # else if {_face} = BlockFace.EAST!:
  60. # set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
  61. # else if {_face} = BlockFace.SOUTH!:
  62. # set {_strip} to (new BoundingBox(0, 0.5, 0, 1, 1, 0.5))
  63. # else if {_face} = BlockFace.WEST!:
  64. # set {_strip} to (new BoundingBox(0.5, 0.5, 0, 1, 1, 1))
  65.  
  66. set {_slab} to (new BoundingBox(0, 0, 0, 1, 0.5, 1))
  67.  
  68. {_bi} = Half.TOP!:
  69. {_slab}.shift(vector(0, 0.5, 0))
  70. {_strip} is set:
  71. {_strip}.shift(vector(0, -0.5, 0))
  72. {_eigth} is set:
  73. {_eigth}.shift(vector(0, -0.5, 0))
  74.  
  75. {_slab}.shift({_v})
  76. {_strip}.shift({_v})
  77.  
  78. broadcast "%{_bi}%, %{_face}%, %{_shape}%"
  79.  
  80. return ({_slab}, {_strip})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement