diff --git a/README.md b/README.md index a74826a..88ff825 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,5 @@ # 1PS-and-More -One Player Sleep system and Death Counter Scoreboard addon for Minecraft Bedrock. -Credit to RavinMadHatter for the death counter scoreboard system. - -This includes any utilities that include the Player.Json file; other uses may be added in the future. - -## Warning -This is not updated to 1.20, where the Player Sleep Percentage gamerule was added. You will have to set that percentage to 1 to get the 1 player sleeping effect. You're still free to use this addon, but it'll need to be combined with that gamerule. -The functions in this addon will be adjusted to accomodate this new gamerule soon. +Combined pack using player.json, including: +1. One Player Sleep system (This sends a message in chat for sleeping players, a good morning notice, makes sure sleeppercent is at 0, and resets the weather), originally by AvgZing +2. Death Counter Scoreboard (Scoreboard ID "deaths"), originally by RavinMadHatter +3. AFK Display (Sets players to AFK after 5 minutes, scoreboard ID afk_display), originally by DrAv diff --git a/animation_controllers/afk_display.json b/animation_controllers/afk_display.json new file mode 100644 index 0000000..9f507fe --- /dev/null +++ b/animation_controllers/afk_display.json @@ -0,0 +1,28 @@ +{ + "format_version": "1.10.0", + "animation_controllers": { + "controller.animation.afk_check": { + "states": { + "default": { + "transitions": [ + { + "afk": "!q.is_moving && q.is_alive" + } + ] + }, + "afk": { + "animations": ["afk_timer"], + "transitions": [ + { + "default": "q.is_moving" + } + ], + "on_exit": [ + "/scoreboard players reset @s afk_time", + "/scoreboard players reset @s afk_display" + ] + } + } + } + } +} diff --git a/animation_controllers/death_counter_j5cfmnkccwt7ppim3lsyue.json b/animation_controllers/death_counter.json similarity index 81% rename from animation_controllers/death_counter_j5cfmnkccwt7ppim3lsyue.json rename to animation_controllers/death_counter.json index ea275d0..b797927 100644 --- a/animation_controllers/death_counter_j5cfmnkccwt7ppim3lsyue.json +++ b/animation_controllers/death_counter.json @@ -1,7 +1,7 @@ { "format_version": "1.10.0", "animation_controllers": { - "controller.animation.death_counter_j5cfmnkccwt7ppim3lsyue": { + "controller.animation.death_counter": { "initial_state": "alive", "states": { "alive": { @@ -11,7 +11,7 @@ } ], "on_exit": [ - "/scoreboard players add @s deaths_J5CfmnKCc 1" + "/scoreboard players add @s deaths 1" ] }, "dead": { diff --git a/animations/1ps.json b/animations/1ps.json index 3e289c3..5e9da8b 100644 --- a/animations/1ps.json +++ b/animations/1ps.json @@ -5,15 +5,9 @@ "loop": false, "animation_length": 5.0, "timeline": { - "0.0": "/me \u00c2\u00a7ewent to bed. Sweet dreams.", - "4.9": [ - "/weather rain", - "/title @s actionbar \u00c2\u00a7eGood Morning!" - ], - "5.0": [ - "/toggledownfall", - "/time set 23992" - ] + "0.0": ["/gamerule playersSleepingPercentage 0", "/me §ewent to bed. Sweet dreams."], + "4.9": ["/weather rain", "/title @s actionbar §eGood Morning!"], + "5.0": ["/toggledownfall"] } } } diff --git a/animations/afk_display.json b/animations/afk_display.json new file mode 100644 index 0000000..4c19e14 --- /dev/null +++ b/animations/afk_display.json @@ -0,0 +1,19 @@ +{ + "format_version": "1.8.0", + "animations": { + "animation.start_afk_timer": { + "loop": true, + "animation_length": 1.0, + "timeline": { + "0.0": [ + "/scoreboard objectives add afk_time dummy", + "/scoreboard objectives add afk_display dummy \"§7Player AFK\"", + "/scoreboard objectives setdisplay belowname afk_display", + "/scoreboard players add @s afk_time 1", + "/scoreboard players reset * afk_display", + "/execute as @a[scores={afk_time=300..}] run scoreboard players set @s afk_display 1" + ] + } + } + } +} diff --git a/animations/death_counter.json b/animations/death_counter.json new file mode 100644 index 0000000..5d7e4b4 --- /dev/null +++ b/animations/death_counter.json @@ -0,0 +1,14 @@ +{ + "format_version": "1.10.0", + "animations": { + "animation.start_death_counter": { + "timeline": { + "0.0": [ + "/scoreboard objectives add deaths dummy Deaths" + ] + }, + "animation_length": 1.0, + "loop": false + } + } +} \ No newline at end of file diff --git a/animations/death_counter_start_j5cfmnkccwt7ppim3lsyue.json b/animations/death_counter_start_j5cfmnkccwt7ppim3lsyue.json deleted file mode 100644 index 7d8549e..0000000 --- a/animations/death_counter_start_j5cfmnkccwt7ppim3lsyue.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "format_version": "1.10.0", - "animations": { - "animation.start_death_counter_j5cfmnkccwt7ppim3lsyue": { - "timeline": { - "0.0": [ - "/scoreboard objectives add deaths_J5CfmnKCc dummy Deaths", - "/scoreboard objectives setdisplay list deaths_J5CfmnKCc descending" - ] - }, - "animation_length": 1.0, - "loop": false - } - } -} \ No newline at end of file diff --git a/entities/player.json b/entities/player.json index 742bfde..9fbb3fb 100644 --- a/entities/player.json +++ b/entities/player.json @@ -9,15 +9,18 @@ "scripts": { "animate": [ "1ps", - "death_counter_j5cfmnkccwt7ppim3lsyue", - "start_death_counter_j5cfmnkccwt7ppim3lsyue" + "death_counter", + "start_death_counter", + "afk_check" ] }, "animations": { - "1ps": "controller.animation.1ps", - "start_1ps": "animation.start_1ps", - "death_counter_j5cfmnkccwt7ppim3lsyue": "controller.animation.death_counter_j5cfmnkccwt7ppim3lsyue", - "start_death_counter_j5cfmnkccwt7ppim3lsyue": "animation.start_death_counter_j5cfmnkccwt7ppim3lsyue" + "1ps": "controller.animation.1ps", + "start_1ps": "animation.start_1ps", + "death_counter": "controller.animation.death_counter", + "start_death_counter": "animation.start_death_counter", + "afk_check": "controller.animation.afk_check", + "afk_timer": "animation.start_afk_timer" } }, "component_groups": { @@ -60,138 +63,126 @@ } }, "components": { - "minecraft:experience_reward": { - "on_death": "Math.Min(query.player_level * 7, 100)" - }, - "minecraft:type_family": { - "family": [ - "player" - ] - }, - "minecraft:is_hidden_when_invisible": {}, - "minecraft:loot": { - "table": "loot_tables/empty.json" - }, - "minecraft:collision_box": { - "width": 0.6, - "height": 1.8 - }, - "minecraft:can_climb": {}, - "minecraft:movement": { - "value": 0.1 - }, - "minecraft:hurt_on_condition": { - "damage_conditions": [ - { - "filters": { - "test": "in_lava", - "subject": "self", - "operator": "==", - "value": true - }, - "cause": "lava", - "damage_per_tick": 4 - } - ] - }, - "minecraft:attack": { - "damage": 1 - }, - "minecraft:exhaustion_values": { - "heal": 6, - "jump": 0.05, - "sprint_jump": 0.2, - "mine": 0.005, - "attack": 0.1, - "damage": 0.1, - "walk": 0, - "sprint": 0.01, - "swim": 0.01 - }, - "minecraft:player.saturation": { - "value": 5, - "max": 20 - }, - "minecraft:player.exhaustion": { - "value": 0, - "max": 20 - }, - "minecraft:player.level": { - "value": 0, - "max": 24791 - }, - "minecraft:player.experience": { - "value": 0, - "max": 1 - }, - "minecraft:breathable": { - "total_supply": 15, - "suffocate_time": -1, - "inhale_time": 3.75, - "generates_bubbles": false - }, - "minecraft:nameable": { - "always_show": true, - "allow_name_tag_renaming": false - }, - "minecraft:physics": {}, - "minecraft:pushable": { - "is_pushable": false, - "is_pushable_by_piston": true - }, - "minecraft:insomnia": { - "days_until_insomnia": 3 - }, - "minecraft:rideable": { - "seat_count": 2, - "family_types": [ - "parrot_tame" - ], - "pull_in_entities": true, - "seats": [ - { - "position": [ - 0.4, - -0.2, - -0.1 - ], - "min_rider_count": 0, - "max_rider_count": 0, - "lock_rider_rotation": 0 - }, - { - "position": [ - -0.4, - -0.2, - -0.1 - ], - "min_rider_count": 1, - "max_rider_count": 2, - "lock_rider_rotation": 0 - } + "minecraft:experience_reward": { + "on_death": "Math.Min(query.player_level * 7, 100)" + }, + "minecraft:type_family": { + "family": ["player"] + }, + "minecraft:is_hidden_when_invisible": {}, + "minecraft:loot": { + "table": "loot_tables/empty.json" + }, + "minecraft:collision_box": { + "width": 0.6, + "height": 1.8 + }, + "minecraft:can_climb": {}, + "minecraft:movement": { + "value": 0.1 + }, + "minecraft:hurt_on_condition": { + "damage_conditions": [ + { + "filters": { + "test": "in_lava", + "subject": "self", + "operator": "==", + "value": true + }, + "cause": "lava", + "damage_per_tick": 4 + } + ] + }, + "minecraft:attack": { + "damage": 1 + }, + "minecraft:exhaustion_values": { + "heal": 6, + "jump": 0.05, + "sprint_jump": 0.2, + "mine": 0.005, + "attack": 0.1, + "damage": 0.1, + "walk": 0, + "sprint": 0.01, + "swim": 0.01 + }, + "minecraft:player.saturation": { + "value": 5, + "max": 20 + }, + "minecraft:player.exhaustion": { + "value": 0, + "max": 20 + }, + "minecraft:player.level": { + "value": 0, + "max": 24791 + }, + "minecraft:player.experience": { + "value": 0, + "max": 1 + }, + "minecraft:breathable": { + "total_supply": 15, + "suffocate_time": -1, + "inhale_time": 3.75, + "generates_bubbles": false + }, + "minecraft:nameable": { + "always_show": true, + "allow_name_tag_renaming": false + }, + "minecraft:physics": {}, + "minecraft:pushable": { + "is_pushable": false, + "is_pushable_by_piston": true + }, + "minecraft:insomnia": { + "days_until_insomnia": 3 + }, + "minecraft:rideable": { + "seat_count": 2, + "family_types": ["parrot_tame"], + "pull_in_entities": true, + "seats": [ + { + "position": [0.4, -0.2, -0.1], + "min_rider_count": 0, + "max_rider_count": 0, + "lock_rider_rotation": 0 + }, + { + "position": [-0.4, -0.2, -0.1], + "min_rider_count": 1, + "max_rider_count": 2, + "lock_rider_rotation": 0 + } + ] + }, + "minecraft:conditional_bandwidth_optimization": {}, + "minecraft:block_climber": {}, + "minecraft:environment_sensor": { + "triggers": { + "filters": { + "all_of": [ + { + "test": "has_mob_effect", + "subject": "self", + "value": "bad_omen" + }, + { + "test": "is_in_village", + "subject": "self", + "value": true + } ] - }, - "minecraft:conditional_bandwidth_optimization": {}, - "minecraft:block_climber": {}, - "minecraft:environment_sensor": { - "triggers": { - "filters": { - "all_of": [ - { - "test": "has_mob_effect", - "subject": "self", - "value": "bad_omen" - }, - { - "test": "is_in_village", - "subject": "self", - "value": true - } - ] - }, - "event": "minecraft:trigger_raid" - } + }, + "event": "minecraft:trigger_raid" } + } }, "events": { "minecraft:gain_bad_omen": { diff --git a/manifest.json b/manifest.json index 4805fef..ffe8b2b 100644 --- a/manifest.json +++ b/manifest.json @@ -1,27 +1,27 @@ { "format_version": 2, "header": { - "description": "Multiplayer compatible one-player sleep v2.2 by AvgZing, death counter addition by RavinMaddHatter.", - "name": "AvgZing 1-Player Sleep + Death Counter", - "uuid": "107c45e9-0e6a-465a-83a7-3203229ab807", + "description": "1PS v3.5.1 by AvgZing, death counter by RavinMaddHatter, AFK Display by DrAv", + "name": "BoxOfDevs 1PS, Death, AFK Display", + "uuid": "264e9d43-1567-44f3-933b-34530492955a", "version": [ - 2, - 2, + 3, + 5, 1 ], "min_engine_version": [ 1, - 18, - 10 + 21, + 0 ] }, "modules": [ { "type": "data", - "uuid": "851782bb-5b70-41cd-bb34-6e198304afd3", + "uuid": "a87781ae-a30d-45f0-b83a-6f775ad4e44f", "version": [ - 2, - 2, + 3, + 5, 1 ] }