Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import:
- org.bukkit.util.BoundingBox
- org.bukkit.block.data.Bisected$Half
- org.bukkit.block.BlockFace
- org.bukkit.block.data.type.Stairs$Shape
- options:
- nw-eigth : (new BoundingBox(0, 0.5, 0, 0.5, 1, 0.5))
- ne-eigth : (new BoundingBox(0.5, 0.5, 0, 1, 1, 0.5))
- se-eigth : (new BoundingBox(0.5, 0.5, 0.5, 1, 1, 1))
- sw-eigth : (new BoundingBox(0, 0.5, 0.5, 0.5, 1, 1))
- function getStairAABB(b: block) :: objects:
- {_b}.toString() contains "stair"
- set {_v} to {_b}.getLocation().toVector()
- set {_data} to {_b}.getBlockData()
- set {_face} to {_data}.getFacing().getOppositeFace()
- set {_shape} to {_data}.getShape()
- if {_face} = BlockFace.NORTH!:
- if {_shape} = Shape.STRAIGHT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
- else if {_shape} = Shape.INNER_LEFT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
- set {_eigth} to {@ne-eigth}
- else if {_shape} = Shape.INNER_RIGHT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
- set {_eigth} to {@nw-eigth}
- else if {_shape} = Shape.OUTER_LEFT!:
- set {_eigth} to {@se-eigth}
- else if {_shape} = Shape.OUTER_RIGHT!:
- set {_eigth} to {@sw-eigth}
- else if {_face} = BlockFace.EAST!:
- if {_shape} = Shape.STRAIGHT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
- else if {_shape} = Shape.INNER_LEFT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
- set {_eigth} to {@se-eigth}
- else if {_shape} = Shape.INNER_RIGHT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
- set {_eigth} to {@ne-eigth}
- else if {_shape} = Shape.OUTER_LEFT!:
- set {_eigth} to {@sw-eigth}
- else if {_shape} = Shape.OUTER_RIGHT!:
- set {_eigth} to {@nw-eigth}
- else if {_face} = BlockFace.SOUTH!:
- if {_shape} = Shape.STRAIGHT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0, 1, 1, 0.5))
- else if {_shape} = Shape.INNER_LEFT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0, 1, 1, 0.5))
- set {_eigth} to {@sw-eigth}
- else if {_shape} = Shape.INNER_RIGHT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0, 1, 1, 0.5))
- set {_eigth} to {@se-eigth}
- else if {_shape} = Shape.OUTER_LEFT!:
- set {_eigth} to {@nw-eigth}
- else if {_shape} = Shape.OUTER_RIGHT!:
- set {_eigth} to {@ne-eigth}
- else if {_face} = BlockFace.WEST!:
- if {_shape} = Shape.STRAIGHT!:
- set {_strip} to (new BoundingBox(0.5, 0.5, 0, 1, 1, 1))
- else if {_shape} = Shape.INNER_LEFT!:
- set {_strip} to (new BoundingBox(0.5, 0.5, 0, 1, 1, 1))
- set {_eigth} to {@nw-eigth}
- else if {_shape} = Shape.INNER_RIGHT!:
- set {_strip} to (new BoundingBox(0.5, 0.5, 0, 1, 1, 1))
- set {_eigth} to {@sw-eigth}
- else if {_shape} = Shape.OUTER_LEFT!:
- set {_eigth} to {@ne-eigth}
- else if {_shape} = Shape.OUTER_RIGHT!:
- set {_eigth} to {@se-eigth}
- set {_slab} to (new BoundingBox(0, 0, 0, 1, 0.5, 1)).shift({_v})
- {_strip} is set:
- {_strip}.shift({_v})
- {_eigth} is set:
- {_eigth}.shift({_v})
- {_data}.getHalf() = Half.TOP!:
- {_slab}.shift(vector(0, 0.5, 0))
- {_strip} is set:
- {_strip}.shift(vector(0, -0.5, 0))
- {_eigth} is set:
- {_eigth}.shift(vector(0, -0.5, 0))
- return ({_slab}, {_strip}, {_eigth})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement