-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
16 changed files
with
187 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,7 @@ on: | |
|
||
env: | ||
VERSION: '1.20' | ||
NAME: '' | ||
NAME: 'Advancement-Count' | ||
|
||
jobs: | ||
build: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
### Changed | ||
|
||
- update to Minecraft version 1.20.4 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,32 @@ | ||
# datapack-template | ||
# Advancement-Count | ||
|
||
![release](https://img.shields.io/github/v/release/2mal3/Advancement-Count?style=flat-square) ![version](https://img.shields.io/badge/Minecraft-1.20-orange?style=flat-square) ![downloads](https://img.shields.io/github/downloads/2mal3/Advancement-Count/total?style=flat-square) | ||
|
||
Advancement Count is a simple datapack that awards players a certain number of points for each advancement they complete. | ||
The total number of all points for each player can then be viewed in the player list and compared between players, providing an alternative competition to the normal game play. | ||
|
||
### 📖 Features | ||
|
||
- ⚖️ balanced, point rewards depend on the difficulty of the advancement | ||
- 🚀 fast and optimized, creates no lag | ||
- 🪶 lightweight | ||
- ♻️ fast and complete updates to new versions of Minecraft, thanks to an automated build system | ||
|
||
The maximum number of points you can score is 206. | ||
|
||
### ⭐ Rewards | ||
|
||
- Task (square boxes) → 1 point | ||
- Goal (rounded boxes) → 2 points | ||
- Challenge (decorated boxes) → 5 points | ||
|
||
## 📝 Notes | ||
|
||
- **ONLY** the latest version of the datapack for Fabric and Vanilla 1.20 is supported | ||
- advancements from other datapacks or mods are not supported | ||
- bug reports and suggestions are **ONLY** accepted on [GitHub](https://github.com/2mal3/No-Lag/issues) | ||
- to uninstall, run the command `/function adco:core/uninstall`and then optionally delete the datapack file | ||
- to reset the scores for all current players, run the command `/function adco:reset` | ||
- datapack was created with the help of [beet](https://github.com/mcbeet/beet) | ||
|
||
_v1.15_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
from 2mal3:log import log | ||
|
||
|
||
## Load | ||
function ~/load: | ||
scoreboard objectives add adco.data dummy | ||
|
||
log "info" "server" "Loaded!" | ||
|
||
execute unless score %installed adco.data matches 1 run function ~/install | ||
execute if score %installed adco.data matches 1 unless score $version adco.data matches ctx.meta.version run function ~/update | ||
|
||
|
||
## Install | ||
function ~/load/install: | ||
scoreboard players set %installed adco.data 1 | ||
|
||
scoreboard objectives add 2mal3.debug_mode dummy | ||
scoreboard objectives add adco.score dummy | ||
scoreboard objectives setdisplay list adco.score | ||
scoreboard objectives modify adco.score rendertype integer | ||
# Set the version in format: xx.xx.xx | ||
scoreboard players set $version adco.data ctx.meta.version | ||
|
||
# Sent installation message after 4 seconds | ||
schedule function ~/send_message 4s replace: | ||
tellraw @a: | ||
text: f"Installed {ctx.project_name} {ctx.project_version} from {ctx.project_author}!" | ||
color: "green" | ||
|
||
|
||
## Update | ||
function ~/update: | ||
execute if score $version adco.data matches 10100: | ||
scoreboard players set $version adco.data 10101 | ||
log "info" "server" "Updated to 1.0.1" | ||
|
||
|
||
## Uninstall | ||
function ~/uninstall: | ||
scoreboard objectives remove adco.data | ||
scoreboard objectives remove adco.score | ||
|
||
tellraw @a: | ||
text: f"Uninstalled {ctx.project_name} {ctx.project_version} from {ctx.project_author}!" | ||
color: "green" | ||
|
||
datapack disable f"file/{ctx.project_name}" | ||
datapack disable f"file/{ctx.project_name}.zip" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
|
||
function ~/1: | ||
scoreboard players add @s adco.score 1 | ||
|
||
function ~/2: | ||
scoreboard players add @s adco.score 2 | ||
|
||
function ~/5: | ||
scoreboard players add @s adco.score 5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
|
||
advancement revoke @a everything | ||
|
||
scoreboard objectives remove adco.score | ||
scoreboard objectives add adco.score dummy | ||
scoreboard objectives setdisplay list adco.score | ||
scoreboard objectives modify adco.score rendertype integer | ||
|
||
tellraw @s: | ||
text: "Reset all Advancements for all current players" | ||
color: "gold" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
from beet.contrib.vanilla import Vanilla | ||
|
||
|
||
vanilla_advancements = ctx.inject(Vanilla).mount("data/minecraft/advancements").data.advancements | ||
for name, advancement in vanilla_advancements.items(): | ||
if "recipes" in name: # Skip recipe unlocking advancements | ||
continue | ||
|
||
# Create a predicate for the advancement to test if it has been unlocked | ||
predicate_name = name.split(":")[1].replace("/", "-") | ||
predicate_content = { | ||
"condition": "minecraft:entity_properties", | ||
"entity": "this", | ||
"predicate": { | ||
"type_specific": { | ||
"type": "player", | ||
"advancements": {} | ||
} | ||
} | ||
} | ||
predicate_content["predicate"]["type_specific"]["advancements"][name] = true | ||
predicate f"adco:unlock_previous/{predicate_name}" predicate_content | ||
|
||
# Give the corresponding points to all players that have unlocked the advancement | ||
advancement_content = advancement.data | ||
if advancement_content["display"]["frame"] == "task": | ||
execute if predicate f"adco:unlock_previous/{predicate_name}" run function adco:count/1 | ||
if advancement_content["display"]["frame"] == "goal": | ||
execute if predicate f"adco:unlock_previous/{predicate_name}" run function adco:count/2 | ||
if advancement_content["display"]["frame"] == "challenge": | ||
execute if predicate f"adco:unlock_previous/{predicate_name}" run function adco:count/5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from beet.contrib.vanilla import Vanilla | ||
|
||
|
||
vanilla_advancements = ctx.inject(Vanilla).mount("data/minecraft/advancements").data.advancements | ||
for name, advancement in vanilla_advancements.items(): | ||
if "recipes" in name: # Skip recipe unlocking advancements | ||
continue | ||
|
||
modified_advancement = advancement.data | ||
|
||
if "rewards" not in modified_advancement: | ||
modified_advancement["rewards"] = {} | ||
|
||
if modified_advancement["display"]["frame"] == "task": | ||
modified_advancement["rewards"]["function"] = "adco:count/1" | ||
if modified_advancement["display"]["frame"] == "goal": | ||
modified_advancement["rewards"]["function"] = "adco:count/2" | ||
if modified_advancement["display"]["frame"] == "challenge": | ||
modified_advancement["rewards"]["function"] = "adco:count/5" | ||
|
||
advancement name modified_advancement |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{ | ||
"values": [ | ||
"___:core/load" | ||
"adco:core/load" | ||
] | ||
} |