-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cartokill datapack to kill nearby cartographers when trading. Pre…
…vents server crash.
- Loading branch information
Showing
7 changed files
with
38 additions
and
0 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 |
---|---|---|
@@ -0,0 +1 @@ | ||
../common/build.sh |
10 changes: 10 additions & 0 deletions
10
cartokill/src/data/io.totemo.cartokill/functions/cartokill-load.mcfunction
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,10 @@ | ||
# Use difference between actual no. of trades and stored trade count to detect | ||
# player closing the trade window. cartokill.kills is success count of kill. | ||
scoreboard objectives add cartokill.trade minecraft.custom:minecraft.traded_with_villager | ||
scoreboard objectives add cartokill.oldtr dummy | ||
scoreboard objectives add cartokill.kills dummy | ||
|
||
# Const objective may already be defined by coords datapack. Aint no thang. | ||
scoreboard objectives add const dummy | ||
scoreboard players set 0 const 0 | ||
|
3 changes: 3 additions & 0 deletions
3
cartokill/src/data/io.totemo.cartokill/functions/cartokill-tick.mcfunction
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 @@ | ||
# Initialise to 0. | ||
scoreboard players add @a cartokill.oldtr 0 | ||
execute as @a if score @s cartokill.trade > @s cartokill.oldtr run function io.totemo.cartokill:cartokill-trade |
6 changes: 6 additions & 0 deletions
6
cartokill/src/data/io.totemo.cartokill/functions/cartokill-trade.mcfunction
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,6 @@ | ||
execute at @s as @s store success score @s cartokill.kills run kill @e[type=villager,nbt={Profession:1,Career:2},distance=..7] | ||
execute if score @s cartokill.kills > 0 const run tellraw @s [{"color":"red","text":"To prevent a server crash, nearby cartographers have been killed. Sorry."}] | ||
|
||
# Remember the new trade count. | ||
execute as @s store result score @s cartokill.oldtr run scoreboard players get @s cartokill.trade | ||
|
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,6 @@ | ||
{ | ||
"values": [ | ||
"io.totemo.cartokill:cartokill-load" | ||
] | ||
} | ||
|
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,6 @@ | ||
{ | ||
"values": [ | ||
"io.totemo.cartokill:cartokill-tick" | ||
] | ||
} | ||
|
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,6 @@ | ||
{ | ||
"pack": { | ||
"pack_format": 1, | ||
"description":"Kill nearby cartographers after trading to prevent server crash in pre6." | ||
} | ||
} |