Initial commit

This commit is contained in:
Rares Bozga
2025-11-29 22:53:32 +02:00
parent e9fa13dbd3
commit 461e95114c
157 changed files with 7597 additions and 1 deletions

View File

@@ -0,0 +1,14 @@
furniture_command_furniture:
debug: false
type: command
name: furniture
usage: /furniture
description: Opens the furniture menu.
permission: furniture.command.furniture
tab completions:
1: <list[]>
script:
- if <context.source_type> != player:
- narrate "<&c>You can only use this command as a player."
- stop
- run furniture_menu def.player:<player>

View File

@@ -0,0 +1,47 @@
furniture_config:
debug: false
type: data
# Furniture using note block states
noteblock:
# note_block, custom_model_data = 1 when held
1:
represents: Locker (East)
is: piano,1,false
2:
represents: Locker (South)
is: piano,2,false
3:
represents: Locker (West)
is: piano,3,false
4:
represents: Locker (North)
is: piano,4,false
# Furniture using custom_block.dsc library
custom_block:
# iron_horse_armor, custom_model_data = 1 when held
iron_horse_armor,1:
represents: School Chair
collision: skeleton_skull
iron_horse_armor,2:
represents: TV
collision: barrier
iron_horse_armor,3:
represents: Book (open)
collision: warped_trapdoor
iron_horse_armor,4:
represents: Book
collision: warped_trapdoor
iron_horse_armor,5:
represents: Book Stack
collision: skeleton_skull
iron_horse_armor,6:
represents: Desk Lamp
collision: red_sandstone_wall
iron_horse_armor,7:
represents: Clipboard
collision: warped_trapdoor
# List of collision blocks - disables interaction without perms
collision_blocks:
#- skeleton_skull
#- red_sandstone_Wall
- warped_trapdoor

View File

@@ -0,0 +1,92 @@
furniture_cmd_to_noteblock:
debug: false
type: procedure
definitions: cmd
script:
- define data <script[furniture_config].data_key[noteblock]>
- if !<[data].contains[<[cmd]>]>:
- determine null
- define noteblock_data <[data].get[<[cmd]>].get[is].split[,]>
- define instrument <[noteblock_data].get[1]>
- define note <[noteblock_data].get[2]>
- define switched <[noteblock_data].get[3]>
- determine <material[note_block[instrument=<[instrument]>;note=<[note]>;switched=<[switched]>]]>
furniture_custom_block_any:
debug: false
type: procedure
definitions: material|cmd
script:
- define data <script[furniture_config].data_key[custom_block]>
- determine <[data].contains[<[material].name>,<[cmd]>]>
furniture_cmd_to_custom_block_collision:
debug: false
type: procedure
definitions: material|cmd
script:
- define data <script[furniture_config].data_key[custom_block]>
- if !<[data].contains[<[material].name>,<[cmd]>]>:
- determine null
- determine <[data].get[<[material].name>,<[cmd]>].get[collision]>
furniture_all_items_sorted:
debug: false
type: procedure
script:
- define items <list[]>
- foreach <script[furniture_config].data_key[noteblock]> key:noteblock_cmd as:noteblock_data:
- define noteblock <item[note_block[display=<&f><[noteblock_data].get[represents]>;custom_model_data=<[noteblock_cmd]>]]>
- define items <[items].include[<[noteblock]>]>
- foreach <script[furniture_config].data_key[custom_block]> key:custom_block_item_details as:custom_block_data:
- define custom_block_type_cmd_split <[custom_block_item_details].split[,]>
- define custom_item <item[<[custom_block_type_cmd_split].get[1]>[display=<&f><[custom_block_data].get[represents]>;custom_model_data=<[custom_block_type_cmd_split].get[2]>;hides=all]]>
- define items <[items].include[<[custom_item]>]>
- define items <[items].sort_by_value[display]>
- determine <[items]>
furniture_menu:
debug: false
type: task
definitions: player|page
script:
- define page <[page].if_null[0]>
- define items <proc[furniture_all_items_sorted].get[<[page].mul[45].add[1]>].to[<[page].add[1].mul[45]>]>
- define contents <map[]>
- foreach <[items]> as:item:
- definemap item_entry:
item: <[item]>
script: furniture_menu_give
definitions:
player: <[player]>
item: <[item]>
- define contents <[contents].with[<[loop_index]>].as[<[item_entry]>]>
- if <[page]> > 0:
- define contents_extra:
49:
item: <item[ender_pearl[display=<&a><&lt><&lt>]]>
script: furniture_menu
definitions:
player: <[player]>
page: <[page].sub[1]>
- define contents <[contents].include[<[contents_extra]>]>
- if <[page].add[1].mul[27]> < <[contents].size>:
- define contents_extra:
51:
item: <item[ender_eye[display=<&a><&gt><&gt>]]>
script: furniture_menu
definitions:
player: <[player]>
page: <[page].add[1]>
- define contents <[contents].include[<[contents_extra]>]>
- run menu_open def.player:<[player]> "def.title:<&b> 邑邑<&f>邑邑邑邑鄊" def.size:54 def.contents:<[contents]>
furniture_menu_give:
debug: false
type: task
definitions: player|item
script:
- if !<[player].inventory.can_fit[<[item]>]>:
- narrate targets:<[player]> "<&c>You do not have enough space in your inventory!"
- stop
- give player:<[player]> <[item]> quantity:1

View File

@@ -0,0 +1,105 @@
# NOTE BLOCK HANDLERS
furniture_world_noteblock:
debug: false
type: world
events:
on player places note_block:
- if <player.item_in_hand.custom_model_data.if_null[0]> > 0:
- define noteblock <proc[furniture_cmd_to_noteblock].context[<context.item_in_hand.custom_model_data.if_null[null]>]>
- if <[noteblock]> != null:
- modifyblock <context.location> <[noteblock]> no_physics
- stop
- adjustblock <context.location> note:0
- adjustblock <context.location> instrument:piano
- adjustblock <context.location> switched:false
on player right clicks note_block:
- if !<player.is_sneaking>:
- determine cancelled
on player breaks block:
- if <context.location.below.material.advanced_matches[note_block]>:
- run furniture_world_note_block_undo_update def.at:<context.location.below>
- if <context.location.above.material.advanced_matches[note_block]>:
- run furniture_world_note_block_undo_update def.at:<context.location.above>
on player places block:
- if <context.location.below.material.advanced_matches[note_block]>:
- run furniture_world_note_block_undo_update def.at:<context.location.below>
- if <context.location.above.material.advanced_matches[note_block]>:
- run furniture_world_note_block_undo_update def.at:<context.location.above>
furniture_world_note_block_undo_update:
debug: false
type: task
definitions: at
script:
- define old_material <[at].material>
- modifyblock <[at]> <[old_material]> no_physics delayed
# CUSTOM BLOCK HANDLERS
furniture_world_custom_block:
debug: false
type: world
events:
on player right clicks block:
- if !<player.has_permission[furniture.customblock.place]> && !<player.is_op>:
- stop
- if <context.item.material.advanced_matches[air]>:
- stop
- if !<proc[furniture_custom_block_any].context[<context.item.material>|<context.item.custom_model_data.if_null[0]>]>:
- stop
- ratelimit <player> 5t
- determine cancelled passively
#
- define cursor_solid <player.cursor_on_solid[5].if_null[null]>
- if <[cursor_solid]> == null:
- stop
- define block_face_normal <player.eye_location.ray_trace[range=10;return=normal;ignore=<player>;fluids=false;nonsolids=false]>
- define target_block <[cursor_solid].add[<[block_face_normal]>]>
- if <[target_block].material.is_solid>:
- stop
#
- define material <context.item.material.name>[custom_model_data=<context.item.custom_model_data>]
#
- define pitch <tern[<player.eye_location.pitch.is_more_than_or_equal_to[0]>].pass[0].fail[180]>
- define yaw <player.eye_location.yaw.div_int[45].add[1].div_int[2]>
- if <[yaw]> == 1:
- define yaw 90
- if <[yaw]> == 2:
- define yaw 180
- if <[yaw]> == 3:
- define yaw -90
- if <[yaw]> == 4:
- define yaw 0
#
- define collision_block <proc[furniture_cmd_to_custom_block_collision].context[<context.item.material>|<context.item.custom_model_data>]>
- modifyblock <[target_block]> <[collision_block]> no_physics
#
- run custom_block_create def.at:<[target_block]> def.material:<[material]> def.pitch:<[pitch]> def.yaw:<[yaw]>
- animate <player> animation:ARM_SWING
- playsound sound:BLOCK_STONE_PLACE <player> sound_category:blocks pitch:0.7
on player breaks block:
- if <proc[custom_block_at].context[<context.location>]> == null:
- stop
- if !<player.has_permission[furniture.customblock.break]> && !<player.is_op>:
- determine cancelled passively
- stop
- run custom_block_destroy def.at:<context.location>
#
# WORLDEDIT COMPATIBILITY
#
on custom event id:worldedit_edit:
- announce to_ops "Actor: <context.actor>; Locations: <context.locations>"
# COLLISION BLOCK HANDLERS
furniture_world_collision_block:
debug: false
type: world
events:
on player right clicks block bukkit_priority:high:
- if <context.location.if_null[null]> == null:
- stop
- if !<player.has_permission[furniture.collisionblock.interact]> && !<player.is_op>:
- stop
- if <context.location.material.advanced_matches[air].if_null[false]>:
- stop
- if <script[furniture_config].data_key[collision_blocks].contains[<context.location.material.name>].if_null[false]>:
- determine cancelled