• check_circle Functions
  • 4,543 views, 12 today
  • 103 downloads, 2 today
  • 4
  • 2
  • 1
Finefit avatar Finefit
Level 30 : Artisan Engineer
This datapack adds a chestshop like feature! good for small servers.

When the pack is installed do /reload and it should reply with "reloaded"

To make a shop rename some diamond to "Cost" in a anvil, case sensitive. Then throw 1-10 of them on top of a chest depending on how much you want the chest to cost. Then fill the bottom chest with what you want to sell.

To buy, put 1-10 "Cost" diamonds in the top depending on how much it costs, single stack.

Please send feedback this pack took a while.
CompatibilityMinecraft 1.13
toMinecraft 1.15

Create an account or sign in to comment.

01/05/2020 4:10 am
Level 41 : Master Engineer
UncleThaodan avatar
To avoid having to hard-code every possible price you should store the amount of diamonds present to a scoreboard and then compare that score:

execute as @e[type=minecraft:armor_stand,tag=CS] at @s store result score @s
funds run data get block ~ ~ ~2 Items[{id:"minecraft:diamond",tag:{display:{Name:"{\"text":\"Cost\"}"}}}].Count
execute as @e[type=minecraft:armor_stand,tag=CS] if score @s funds = @s cost run clone...
execute as @e[type=minecraft:armor_stand,tag=CS] if score @s funds = @s cost run clone...
execute as @e[type=minecraft:armor_stand,tag=CS] if score @s funds = @s cost run clone...

This will allow you to use 1-64 as a price instead of 1-10 and you only need to do it once.

If you want to improve it further you can calculate "funds - cost" and store it into "Items[{id:"minecraft:diamond",tag:{display:{Name:"{\"text":\"Cost\"}"}}}].Count" and add "cost"-amount of diamonds to wherever you want the shop owner to collect them; you'll need to use "@s funds >= @s cost" when checking if there are enough diamonds present.
Planet Minecraft


© 2010 - 2021