This script is for developers who like to use interactable blocks in their builds but don't want players to utilize them for their intended purpose. For example, maybe you are using vertical trapdoors as a fence line, or you want a strictly cosmetic chest or anvil or enchanting table? Or maybe you just want to make your pressure plate table-tops stop clicking when folks get too close?
To use this script, type /decorate. You'll get a special stick you can whack things with to make them decorative, because who doesn't like whacking things with a stick? It's fun AND user-friendly!
To Do:
UPDATE 6/25/2020:
- Fix:
- Minor bug fix: Added some fallbacks to prevent console errors occurring under certain circumstances when players right-clicked air.
Update History
Known Issues:
Here's a link to a haste: https://one.denizenscript.com/haste/71421
Or click Show to show the script in this post.
To use this script, type /decorate. You'll get a special stick you can whack things with to make them decorative, because who doesn't like whacking things with a stick? It's fun AND user-friendly!
To Do:
- Identify any missed blocks that ought to be "decoratable."
- Continue entity support with
painting
anditem_frame
entities. - Allow decorators to lock a
campfire
with food on it, preventing the food from ever finishing its cooking process. - Update for 1.16 blocks (after Paper 1.16 release).
UPDATE 6/25/2020:
- Fix:
daylight_dector
now correctly toggles state when sneak-right-clicked with the decorator tool.- Minor bug fix: Added some fallbacks to prevent console errors occurring under certain circumstances when players right-clicked air.
Update History
UPDATE 6/23/2020:
- Added some functionality for the manipulation of
- Added a feature that converts
- Placing a
- Fixed a few issues where "attached blocks" were erroneously being added/removed as decorative.
**The
UPDATE 6/14/2020:
- Added support for
UPDATE 6/12/2020:
- Fixed an egregious error created by renaming the decorator_tool script in the previous update.
- Added support for
UPDATE 6/7/2020:
- Changed scriptnames to be a bit more consistent.
- Added a config script.
- Added optional narrate to warn players when clicking decorative blocks. (Disabled by default)
- Added some functionality for the manipulation of
armor_stand
entities. Making an armor stand decorative will disable its gravity and collisions, and allow the user to move it, rotate it, and toggle its states such as base plate visibility, small/regular size, arms shown/hidden, and invisibility. (Armor stand functionality can be disabled globally in the config.)- Added a feature that converts
player_head
blocks into entities (as the helmet slot of an armor stand) automatically.** (This feature can be disabled in the config.)- Placing a
chest
next to a decorative chest will now correctly prevent the chests from conjoining. If you wish to make a decorative double chest, simply place the second block before decorating.- Fixed a few issues where "attached blocks" were erroneously being added/removed as decorative.
**The
player_head
entity's armor stand will be set to visible by default. This is due to limits of the 'left click' functionality with invisible armor stands, a known issue planned to be fixed in a future update. Once you're finished manipulating the player head entity, you can use the Decorator Tool to make the armor stand invisible.UPDATE 6/14/2020:
- Added support for
jukebox
, daylight_detector
, bell
, cauldron
, ender_chest
, end_portal_frame
, composter
, campfire
, flower_pot
, beacon
, and command_block
*.UPDATE 6/12/2020:
- Fixed an egregious error created by renaming the decorator_tool script in the previous update.
- Added support for
light_weighted_pressure_plate
and heavy_weighted_pressure_plate
. (Thanks Kiryll!)UPDATE 6/7/2020:
- Changed scriptnames to be a bit more consistent.
- Added a config script.
- Added optional narrate to warn players when clicking decorative blocks. (Disabled by default)
Known Issues:
player_head
entities created with the new functionality are rotated the opposite direction.player_head
entities have visible armor stands because of limitations of 'left-click' actions on an invisiblearmor_stand
.- Invisible
armor_stand
entities are immune to left-click actions with the Decorator Tool. For now, make them visible first (using the Decorator Tool item) - A decorative
command_block
will flicker its GUI very briefly when players interact with it.
Here's a link to a haste: https://one.denizenscript.com/haste/71421
Or click Show to show the script in this post.
Code:
Decorator_Tool_Config:
type: data
Config:
# Change to true to warn players when they attempt to interact with decorative blocks.
# No message by default.
do_message: false
message: <dark_red>You cannot use this decorative <context.location.material.translated_name>.
cooldown: 1s
# Enables armor stand functionality with Decorator Tool.
# Disable if using another armor stand editor plugin.
do_armor_stands: true
# If true, converts player head blocks to armor stand entities when right-clicked.
# Generally only useful if armor stand functionality is enabled.
convert_heads: true
Data:
## The data in this section should not be changed.
armor_stand_mode: 1/rotate|2/move_x|3/move_z|4/move_y|5/base_plate|6/arms|7/size|8/invisibility
misc_blocks:
- loom
- crafting_table
- cartography_table
- anvil
- chipped_anvil
- damaged_anvil
- enchanting_table
- grindstone
- smithing_table
- stonecutter
- fletching_table
- light_weighted_pressure_plate
- heavy_weighted_pressure_plate
- jukebox
- daylight_detector
- bell
- cauldron
- ender_chest
- end_portal_frame
- composter
- campfire
- flower_pot
- beacon
- command_block
- cake
Decorator_Tool_Item:
type: item
material: stick
display name: <blue>Decorator Tool
lore:
- Right-click to mark location as decorative.
- Left-click to unmark location.
- Shift-right-click to toggle block state.
Decorator_Tool_Command:
type: command
name: decorate
usage: /decorate
permission: beruscripts.decorator
description: Gives the player a Decorator Tool.
script:
- if !<player.inventory.contains[decorator_tool_item]>:
- give decorator_tool_item
- narrate "<aqua>You received a <blue>[Decorator Tool]<aqua>."
- narrate "<gray>Right-click to decorate, left-click to un-decorate."
- narrate "<gray>Right-click while sneaking to toggle open/closed."
- else:
- take scriptname:decorator_tool_item
- narrate "<red>Removed your <blue>[Decorator Tool]<red>."
Decorator_Tool_Decorative_Blocks:
type: world
debug: false
events:
# Decorative Block functionality-- prevents use of blocks marked as decorative.
on player right clicks block priority:1:
- if <server.has_flag[decorative_block.<context.location.simple>]||false>:
- determine passively cancelled
- if <script[Decorator_Tool_Config].data_key[Config.do_message]> && !<player.has_flag[decorative_block_warn]>:
- narrate "<script[Decorator_Tool_Config].data_key[Config.message].parsed>"
- flag <player> decorative_block_warn duration:<script[Decorator_Tool_Config].data_key[Config.cooldown]>
on player stands on material:
- if <server.has_flag[decorative_block.<context.location.simple>]||false>:
- determine cancelled
# Decorator Tool functionality-- allows use of Decorator Tool item on various blocks.
on player clicks block with decorator_tool_item:
- determine passively cancelled
- if <player.is_sneaking> && <context.click_type> == right_click_block:
- if <context.location.material.name> == daylight_detector:
- adjustblock <context.location> switched:<context.location.material.switched.not>
- else:
- switch <context.location>
- stop
- choose <context.click_type>:
- case right_click_block:
- if <context.location.material.name> == player_head && <script[Decorator_Tool_Config].data_key[Config.convert_heads]>:
- spawn armor_stand[gravity=false;invulnerable=true;collidable=false;armor_pose=head|0,0,0;equipment=air|air|air|<item[player_head].with[skull_skin=<context.location.skull_skin.full>]>] <context.location.center.with_facing_direction[<context.location.direction>].below[1.94]> save:decorative_head
- flag <entry[decorative_head].spawned_entity> decorative
- modifyblock <context.location> air
- stop
- else if !<context.location.material.is_switchable> && !<context.location.has_inventory> && !<script[Decorator_Tool_Config].data_key[Data.misc_blocks].contains[<context.location.material.name>]> && !<context.location.material.name.ends_with[_bed]>:
- narrate "<dark_gray>You cannot make <context.location.material.item.formatted> decorative."
- stop
- if <server.has_flag[decorative_block.<context.location.simple>]||false>:
- narrate "<dark_gray>This <gray><context.location.material.translated_name> <dark_gray>is already decorative!"
- stop
- narrate "<aqua>Made this <gray><context.location.material.translated_name> <aqua>decorative."
- flag server decorative_block.<context.location.simple>
- if <context.location.other_block.simple||null> != null:
- narrate "<aqua>(Also added adjacent block.)"
- flag server decorative_block.<context.location.other_block.simple>
- case left_click_block:
- if !<server.has_flag[decorative_block.<context.location.simple>]||false>:
- narrate "<dark_gray>This <gray><context.location.material.translated_name> <dark_gray>is not decorative!"
- stop
- narrate "<red>This <gray><context.location.material.translated_name> <red>is no longer decorative."
- flag server decorative_block.<context.location.simple>:!
- if <context.location.other_block||null> != null:
- narrate "<red>(Also removed adjacent block.)"
- flag server decorative_block.<context.location.other_block.simple>:!
# Item protection-- Prevents Decorator Tool from being transfered to another inventory.)
on player drops decorator_tool_item:
- determine passively cancelled
- wait 1t
- take scriptname:decorator_tool_item
on player clicks in inventory with decorator_tool_item:
- if <context.clicked_inventory.inventory_type> != PLAYER:
- determine passively cancelled
- wait 1t
- inventory update
on player clicks decorator_tool_item in inventory:
- if <context.is_shift_click> && <context.inventory.inventory_type> != PLAYER:
- determine passively cancelled
- wait 1t
- inventory update
on player drags decorator_tool_item in inventory:
- if <context.clicked_inventory.inventory_type> != PLAYER:
- determine passively cancelled
- wait 1t
- inventory update
# If any player breaks a decorative block, alerts them and removes decoration flag.
on player breaks block priority:1:
- if <server.has_flag[decorative_block.<context.location.simple>]||false>:
- narrate "<red>You broke a decorative <context.location.material.translated_name.to_lowercase>."
- flag server decorative_block.<context.location.simple>:!
- if <context.location.other_block||null> != null:
- narrate "<red>(Also removed adjacent block.)"
- flag server decorative_block.<context.location.other_block.simple>:!
- if <context.location.material.name> == chest:
- modifyblock <context.location.other_block> air
# Decorative Chest functionality-- for placing chests next to existing decorative chests.
# A chest placed next to a decorative chest will not conjoin to it, nor be decorative itself.
on player places *chest:
- if <context.location.other_block||null> != null && <server.has_flag[decorative_block.<context.location.other_block.simple>]>:
- determine passively cancelled
- if <player.gamemode> != creative:
- take iteminhand qty:1
- wait 1t
- modifyblock <context.location> <context.material.with[direction=<context.location.direction[<player.location>]>]>
# You can disable armor stand functionality in the Config!
# Set "do_armor_stands" to false.
Decorator_Tool_Armor_Stands:
type: world
debug: false
events:
on armor_stand damaged priority:1:
- if <context.entity.has_flag[decorative]>:
- determine passively cancelled
on armor_stand damaged by player with:decorator_tool_item:
- determine passively cancelled
- if !<script[Decorator_Tool_Config].data_key[Config.do_armor_stands]>:
- stop
- if !<context.entity.has_flag[decorative]>:
- flag <context.entity> decorative
- adjust <context.entity> gravity:false
- adjust <context.entity> invulnerable:true
- adjust <context.entity> collidable:false
- adjust <context.entity> armor_pose:head|0,0,0
- narrate "<aqua>Made this <gray>Armor Stand <aqua>decorative. <dark_gray>(Shift-left-click to destroy.)"
- stop
- if <player.is_sneaking>:
- if <player.flag[decorator_tool_delete_entity]||null> == <context.entity.uuid>:
- flag <player> decorator_tool_delete_entity:!
- remove <context.entity>
- narrate "<red>Removed!"
- else:
- flag <player> decorator_tool_delete_entity:<context.entity.uuid>
- adjust <context.entity> glowing:true
- narrate "<dark_red>Destroy this armor stand? <dark_gray>(Shift-left-click again to confirm.)"
- wait 3s
- flag <player> decorator_tool_delete_entity:!
- adjust <context.entity> glowing:false
- else:
- choose <player.flag[decorator_tool_armor_stand_mode]||1>:
- case 1:
- teleport <context.entity> <context.entity.location.with_yaw[<context.entity.location.yaw.sub[5]>]>
- case 2:
- teleport <context.entity> <context.entity.location.sub[0.02,0,0]>
- case 3:
- teleport <context.entity> <context.entity.location.sub[0,0,0.02]>
- case 4:
- teleport <context.entity> <context.entity.location.sub[0,0.02,0]>
- case 5:
- adjust <context.entity> base_plate:<context.entity.base_plate.not>
- case 6:
- adjust <context.entity> arms:<context.entity.arms.not>
- case 7:
- adjust <context.entity> is_small:<context.entity.is_small.not>
- case 8:
- adjust <context.entity> visible:<context.entity.visible.not>
on player right clicks armor_stand with:decorator_tool_item:
- determine passively cancelled
- if !<script[Decorator_Tool_Config].data_key[Config.do_armor_stands]>:
- stop
- if !<context.entity.has_flag[decorative]>:
- flag <context.entity> decorative
- adjust <context.entity> gravity:false
- adjust <context.entity> invulnerable:true
- adjust <context.entity> collidable:false
- adjust <context.entity> armor_pose:head|0,0,0
- narrate "<aqua>Made this <gray>Armor Stand <aqua>decorative. <dark_gray>(Shift-left-click to destroy.)"
- stop
- if <player.is_sneaking>:
- if <player.flag[decorator_tool_armor_stand_mode]> < 8:
- flag <player> decorator_tool_armor_stand_mode:++
- else:
- flag <player> decorator_tool_armor_stand_mode:1
- actionbar "<blue>[Decorator Tool]: <aqua>Armor Stand Mode - <script[Decorator_Tool_Config].data_key[Data.armor_stand_mode].as_map.get[<player.flag[decorator_tool_armor_stand_mode]>].replace[_].with[ ].to_titlecase>"
- else:
- choose <player.flag[decorator_tool_armor_stand_mode]||1>:
- case 1:
- teleport <context.entity> <context.entity.location.with_yaw[<context.entity.location.yaw.add[5]>]>
- case 2:
- teleport <context.entity> <context.entity.location.add[0.02,0,0]>
- case 3:
- teleport <context.entity> <context.entity.location.add[0,0,0.02]>
- case 4:
- teleport <context.entity> <context.entity.location.add[0,0.02,0]>
- case 5:
- adjust <context.entity> base_plate:<context.entity.base_plate.not>
- case 6:
- adjust <context.entity> arms:<context.entity.arms.not>
- case 7:
- adjust <context.entity> is_small:<context.entity.is_small.not>
- case 8:
- adjust <context.entity> visible:<context.entity.visible.not>