Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import:
- # org.bukkit.block
- org.bukkit.util.BoundingBox
- net.minecraft.server.v1_13_R2.EnumDirection$EnumAxis
- net.minecraft.server.v1_13_R2.Block
- net.minecraft.server.v1_13_R2.BlockPosition
- net.minecraft.server.v1_13_R2.IBlockData
- net.minecraft.server.v1_13_R2.IBlockAccess
- org.bukkit.block.data.Bisected$Half
- org.bukkit.block.BlockFace
- org.bukkit.block.data.type.Stairs$Shape
- function getStairAABB(b: block) :: objects:
- {_b}.toString() contains "stair"
- set {_v} to {_b}.getLocation().toVector()
- set {_data} to {_b}.getBlockData()
- set {_bi} to {_data}.getHalf()
- 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 (new BoundingBox(0.5, 0.5, 0, 1, 1, 0.5))
- else if {_shape} = Shape.INNER_RIGHT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
- set {_eigth} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 0.5))
- else if {_shape} = Shape.OUTER_LEFT!:
- set {_eigth} to (new BoundingBox(0.5, 0.5, 0.5, 1, 1, 1))
- else if {_shape} = Shape.OUTER_RIGHT!:
- set {_eigth} to (new BoundingBox(0, 0.5, 0.5, 0.5, 1, 1))
- 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 (new BoundingBox(0.5, 0.5, 0, 1, 1, 0.5))
- else if {_shape} = Shape.INNER_RIGHT!:
- set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
- set {_eigth} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 0.5))
- else if {_shape} = Shape.OUTER_LEFT!:
- set {_eigth} to (new BoundingBox(0.5, 0.5, 0.5, 1, 1, 1))
- else if {_shape} = Shape.OUTER_RIGHT!:
- set {_eigth} to (new BoundingBox(0, 0.5, 0.5, 0.5, 1, 1))
- # if {_shape} = Shape.STRAIGHT!:
- # if {_face} = BlockFace.NORTH!:
- # set {_strip} to (new BoundingBox(0, 0.5, 0.5, 1, 1, 1))
- # else if {_face} = BlockFace.EAST!:
- # set {_strip} to (new BoundingBox(0, 0.5, 0, 0.5, 1, 1))
- # else if {_face} = BlockFace.SOUTH!:
- # set {_strip} to (new BoundingBox(0, 0.5, 0, 1, 1, 0.5))
- # else if {_face} = BlockFace.WEST!:
- # set {_strip} to (new BoundingBox(0.5, 0.5, 0, 1, 1, 1))
- set {_slab} to (new BoundingBox(0, 0, 0, 1, 0.5, 1))
- {_bi} = 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))
- {_slab}.shift({_v})
- {_strip}.shift({_v})
- broadcast "%{_bi}%, %{_face}%, %{_shape}%"
- return ({_slab}, {_strip})
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement