Minecraft
Minecraft-related functionality.
App
The main delivery method for scarpet programs into the game is in the form of apps in *.sc files located in the world scripts folder, flat. In singleplayer, you can also save apps in .minecraft/config/carpet/scripts for them to be available in any world, and here you can actually organize them in folders. When loaded (via /script load command, etc.), the game will run the content of the app once, regardless of its scope (more about the app scopes below), without executing of any functions, unless called directly, and with the exception of the __config() function, if present, which will be executed once.
Blocks and World
- air()
- biome()
- blast_resistance()
- block_data()
- block_light()
- block_list()
- block_properties()
- block_sound()
- block_state()
- block_tags()
- block_tick()
- block()
- blocks_daylight()
- blocks_movement()
- create_explosion()
- destroy()
- diamond()
- effective_light()
- emitted_light()
- flammable()
- generation_status()
- hardness()
- harvest()
- in_slime_chunk()
- inhabited_time()
- is_chunk_generated()
- light()
- liquid()
- loaded_ep()
- loaded_status()
- loaded()
- map_colour()
- material()
- neighbours()
- opacity()
- place_item()
- plop()
- poi()
- pos_offset()
- pos()
- power()
- property()
- random_tick()
- rect()
- reload_chunk()
- reset_chunk()
- sample_noise()
- scan()
- see_sky()
- set_biome()
- set_poi()
- set_structure()
- set()
- sky_light()
- solid()
- spawn_potential()
- structure_eligibility()
- structure_references()
- structures()
- suffocates()
- ticks_randomly()
- top()
- transparent()
- update()
- volume()
- weather()
- without_updates()
Entity
- entity_area()
- entity_event()
- entity_id()
- entity_list()
- entity_load_handler()
- entity_selector()
- entity_types()
- modify(e, 'absorption')
- modify(e, 'accelerate')
- modify(e, 'add_exhaustion')
- modify(e, 'add_xp')
- modify(e, 'age')
- modify(e, 'ai')
- modify(e, 'air')
- modify(e, 'blue_skull')
- modify(e, 'breaking_progress')
- modify(e, 'breeding_age')
- modify(e, 'clear_tag')
- modify(e, 'custom_name')
- modify(e, 'despawn_timer')
- modify(e, 'dismount')
- modify(e, 'drop_passengers')
- modify(e, 'effect')
- modify(e, 'exhaustion')
- modify(e, 'fire')
- modify(e, 'fly_speed')
- modify(e, 'flying')
- modify(e, 'frost')
- modify(e, 'gamemode')
- modify(e, 'gravity')
- modify(e, 'head_yaw')
- modify(e, 'health')
- modify(e, 'home')
- modify(e, 'hunger')
- modify(e, 'insta_build')
- modify(e, 'invulnerable')
- modify(e, 'item')
- modify(e, 'jump')
- modify(e, 'jumping')
- modify(e, 'kill')
- modify(e, 'location')
- modify(e, 'look')
- modify(e, 'may_build')
- modify(e, 'may_fly')
- modify(e, 'motion_x')
- modify(e, 'motion')
- modify(e, 'mount_passengers')
- modify(e, 'mount')
- modify(e, 'move')
- modify(e, 'nbt_merge')
- modify(e, 'nbt')
- modify(e, 'no_clip')
- modify(e, 'offering_flower')
- modify(e, 'persistence')
- modify(e, 'pickup_delay')
- modify(e, 'pitch')
- modify(e, 'portal_cooldown')
- modify(e, 'portal_timer')
- modify(e, 'pos')
- modify(e, 'remove')
- modify(e, 'saturation')
- modify(e, 'selected_slot')
- modify(e, 'silent')
- modify(e, 'spawn_point')
- modify(e, 'swing')
- modify(e, 'tag')
- modify(e, 'talk')
- modify(e, 'unmountable')
- modify(e, 'walk_speed')
- modify(e, 'x')
- modify(e, 'xp_level')
- modify(e, 'xp_progress')
- modify(e, 'xp_score')
- player()
- query(e, 'absorption')
- query(e, 'active_block')
- query(e, 'age')
- query(e, 'air')
- query(e, 'attribute')
- query(e, 'blue_skull')
- query(e, 'brain')
- query(e, 'breaking_progress')
- query(e, 'breeding_age')
- query(e, 'category')
- query(e, 'client_brand')
- query(e, 'command_name')
- query(e, 'count')
- query(e, 'despawn_timer')
- query(e, 'dimension')
- query(e, 'effect')
- query(e, 'entity_tags')
- query(e, 'exhaustion')
- query(e, 'eye_height')
- query(e, 'facing')
- query(e, 'fire')
- query(e, 'fly_speed')
- query(e, 'flying')
- query(e, 'frost')
- query(e, 'gamemode_id')
- query(e, 'gamemode')
- query(e, 'gravity')
- query(e, 'has_entity_tag')
- query(e, 'has_scoreboard_tag')
- query(e, 'head_yaw')
- query(e, 'health')
- query(e, 'height')
- query(e, 'holds')
- query(e, 'home')
- query(e, 'hunger')
- query(e, 'id')
- query(e, 'immune_to_fire')
- query(e, 'immune_to_frost')
- query(e, 'insta_build')
- query(e, 'invulnerable')
- query(e, 'is_baby')
- query(e, 'is_burning')
- query(e, 'is_freezing')
- query(e, 'is_ridden')
- query(e, 'is_riding')
- query(e, 'item')
- query(e, 'jumping')
- query(e, 'language')
- query(e, 'location')
- query(e, 'look')
- query(e, 'may_build')
- query(e, 'may_fly')
- query(e, 'motion_x')
- query(e, 'motion')
- query(e, 'mount')
- query(e, 'name')
- query(e, 'nbt')
- query(e, 'offering_flower')
- query(e, 'on_ground')
- query(e, 'passengers')
- query(e, 'path')
- query(e, 'permission_level')
- query(e, 'persistence')
- query(e, 'pickup_delay')
- query(e, 'ping')
- query(e, 'pitch')
- query(e, 'player_type')
- query(e, 'portal_cooldown')
- query(e, 'portal_timer')
- query(e, 'pos')
- query(e, 'pose')
- query(e, 'removed')
- query(e, 'saturation')
- query(e, 'score')
- query(e, 'scoreboard_tags')
- query(e, 'selected_slot')
- query(e, 'silent')
- query(e, 'sneaking')
- query(e, 'spawn_point')
- query(e, 'sprinting')
- query(e, 'swimming')
- query(e, 'swinging')
- query(e, 'target')
- query(e, 'team')
- query(e, 'trace')
- query(e, 'unmountable')
- query(e, 'uuid')
- query(e, 'walk_speed')
- query(e, 'width')
- query(e, 'x')
- query(e, 'xp_level')
- query(e, 'xp_progress')
- query(e, 'xp')
- spawn()
Inventory
Most functions in this category require inventory as the first argument. Inventory could be specified by an entity, or a block, or position (three coordinates) of a potential block with inventory, or can be preceded with inventory type. Inventory type can be null (default), 'enderchest' denoting player enderchest storage, or 'equipment' applying to entities hand and armour pieces. Then the type can be followed by entity, block or position coordinates. For instance, player enderchest inventory requires two arguments, keyword 'enderchest', followed by the player entity argument, (or a single argument as a string of a form: 'enderchest_steve' for legacy support).
- close_screen()
- crafting_remaining_item()
- create_screen()
- drop_item()
- inventory_find()
- inventory_get()
- inventory_has_items()
- inventory_remove()
- inventory_set()
- inventory_size()
- item_list()
- item_tags()
- recipe_data()
- screen_property()
- stack_limit()
Global Events
Global events will be handled once per app that is with 'global' scope. With player scoped apps, each player instance will be triggered once for each player, so a global event may be executed multiple times for such apps.
- carpet_rule_changes
- chunk_generated
- chunk_loaded
- chunk_unloaded
- explosion
- explosion_outcome
- lightning
- server_shuts_down
- server_starts
- tick
- tick_ender
- tick_nether
Player Events
These are triggered with a player context. For apps with a 'player' scope, they trigger once for the appropriate player. In apps with global scope they trigger once as well as a global event.
- player_attacks_entity
- player_breaks_block
- player_changes_dimension
- player_chooses_recipe
- player_clicks_block
- player_collides_with_entity
- player_command
- player_connects
- player_deals_damage
- player_deploys_elytra
- player_dies
- player_disconnects
- player_drops_item
- player_drops_stack
- player_escapes_sleep
- player_finishes_using_item
- player_interacts_with_block
- player_interacts_with_entity
- player_jumps
- player_message
- player_picks_up_item
- player_places_block
- player_placing_block
- player_releases_item
- player_respawns
- player_rides
- player_right_clicks_block
- player_starts_sneaking
- player_starts_sprinting
- player_stops_sneaking
- player_stops_sprinting
- player_swaps_hands
- player_swings_hand
- player_switches_slot
- player_takes_damage
- player_trades
- player_uses_item
- player_wakes_up
- statistic
Auxillary
- bossbar()
- create_datapack()
- create_marker()
- current_dimension()
- day_time()
- delete_file()
- display_title()
- draw_shape()
- enable_hidden_dimensions()
- encode_nbt()
- escape_nbt()
- format()
- game_tick()
- get_mob_counts()
- handle_event()
- in_dimension()
- item_display_name()
- last_tick_times()
- list_files()
- load_app_data()
- logger()
- nbt_storage()
- nbt()
- parse_nbt()
- particle_box()
- particle_line()
- particle()
- print()
- read_file()
- remove_all_markers()
- run()
- save()
- schedule()
- scoreboard_add()
- scoreboard_display()
- scoreboard_property()
- scoreboard_remove()
- scoreboard()
- seed()
- signal_event()
- sound()
- statistic()
- store_app_data()
- system_info()
- tag_matches()
- team_add()
- team_leave()
- team_list()
- team_property()
- team_remove()
- tick_time()
- view_distance()
- world_time()
- write_file()