Minecraft Data Packs / Game Mechanic

Concept/Prototype/Tutorial: Reward Structure Repair

  • check_circle Advancements
  • check_circle Functions
  • check_circle Recipes
  • check_circle Structures
  • 2,868 views, 1 today
  • 82 downloads, 0 today
  • 28
  • 12
  • 4
kaimedina's Avatar kaimedina
Level 36 : Artisan Engineer
18

Update: Natural Decay has been created off of this prototype! Check it out here https://www.planetminecraft.com/data-pack/kai-s-decay-amp-devine-natural-structure-decay-datapack/

Intro


Naturally spawning structures often come in the form of dungeons and ruins - but what happens when all the enemies are killed and the chests looted? Let's encourage a player to engage with your work, and incorporate the structure into their livings!

This datapack is a concept/prototype/tutorial to reward players for repairing and housing within your datapack's ruins!

What is in this prototype?

This prototype contains one structure: a broken tower. When loaded in, there are four events for the tower:

1. An achievement for staying in the tower for a minecraft day
2. An achievement for repairing the tower (adding more stone bricks, removing the mossy bricks and vines)
3. An infestation of silverfish if too much of the tower gets destroyed
4. An achievement if too many mossy blocks become present

How can these functions be used / expanded upon? AKA why does this matter?

1. The ability to tell how many of a block are present in a structure is pretty great! When a player is within 10 blocks of the structure, a repeating command is executed at an invisible/invulnerable armorstand named KaiTower. This runs a clone command that in an instant (without disturbing things like item frames) clones the object to where it exactly is, and outputs the number of mossy stone bricks into the scoreboard 'MossyStoneBrickKai' for the individual amour stand.
execute as @e[name=KaiTower] at @s if entity @p[distance=..10] store result score @s MossyStoneBrickKai run clone ~-6 ~-6 ~-6 ~6 ~6 ~6 ~-6 ~-6 ~-6 filtered minecraft:mossy_stone_bricks forceThis means that every tower structure will have it's own counter as to how many stone blocks it has. If I add more stone bricks to this tower, unless someone is doing something outthere or knows how this datapack works, it is ok to assume they are repairing / repurposing the structure. If 90% of the stone bricks are removed, it is fair to assume the structure is being removed.

This can be expanded upon through any blocks. You can occasionally check if farmed dirt exists nearby, and how much, to see how much agriculture is done in the area, which helps declare a player present. If you know how to code mossy bricks to spread into other bricks turning them mossy, you have a lawn care datapack just waiting to happen, since you can see how much mossy brick is present at a time! Now that you can detect blocks, from crafting tables and chests, to wither skulls and diamond blocks, you can engage your players further with new plot points!

2. The ability to tell how how long a player has been in an area. The below code runs a timer only if a player is within 15 blocks of the invisible/invulnerable armor stand, then gives an achievement while your in the tower once you hit 24000 ticks (a minecraft day). execute as @e[name=KaiTower] at @s if entity @p[distance=..15] run scoreboard players add @s KaiTimer 1
execute as @a[advancements={fixitup:towerday=false}] at @s if score @e[name=KaiTower,distance=..10,limit=1] KaiTimer matches 24000.. run advancement grant @s only fixitup:towerday
This means, unless someone is afk'ing, which then can have it's own ways of being detected and sorted out (using playerstats for walking and such), you can see if someone is generally living in a plot of land. This combined with the above stone/farming blocks method, means you get to know if someone is repairing and using your structure.

Or alternatively, is this structure in a loaded chunk but is being left to rot? Maybe it's time to add some decay to your datapacks. Time to replace random air blocks with spiderwebs, and once enough spiderwebs are detected, the occasionally spawning of spiders via a coded timer plus a degree of randomness.

3. Versatility: based on how the code works, every single structure loaded in has it's own stats. You can tell how many are loaded in, and all the numbers are there regardless on what players move through or do. If I live in one tower, it won't affect the numbers of another. The only downside is this code is independent of whose staying there (aka if one player stays for half a day, and the other stays for the other half, then the achievment is still given). Honestly it's not that hard to time how long individual players are an area with this code, and if multiple people are moving through a structure as the travelers we are, I see this as a win.

On it's own, this datapack isn't that amazing and spectacular, but combined with your builds and your ideas for stories, lore, and new mechanics, it could really add a new layer to things!

How do I use this prototype?

Download the zip file and place the folder in your datapacks folder of a world. If the world does not see the file, ensure it's not nested in an extra folder that it dosn't need to be in. Give yourself a structure block in the world, place it 2-4 blocks below ground level, and load in "KaiTower" (ENSURE THAT MOBS ARE TURNED ON in the structure block). If you want you can even mess with the deterioration effect in the structure block. That's the full setup! I personally use the program Sublime Text on my macbook to open the code up. If you find the repeat.mcfunction file, that's where most of the code is found. When making datapacks I always recommend naming every scoreboard something unique like I did so they can be compatible with others. The top of the code adds the timer, then it adds together all the scoreboards for each type of mossy block (for one stat to tell how much mossy stuff is in a build), following that code is the check for each specific mossy / stone block in the build, one line of code for the infestation if there's too few stone brick blocks, some dead code as I tried to code in a sponge to clean up moss, and code to give the achievements.

Regarding natural structure generation, I honestly don't know how to go about that. When making code for my friend group's server, I just reverse engineered the Dungeon Now Loading datapack: https://www.planetminecraft.com/data-pack/dungeon-now-loading-5-new-dungeons-5-new-bosses/ but there are probably other methods out there.

Lag concerns?

While on a large multiplayer server I could imagine using clone commands a bunch while everyone has their own structure can get taxing, overall commands mostly just fully run if someones in a structure. So I don't see this being laggy compared to any other datapack out there when used in small to medium structure sizes.

GLITCH: Don't spawn this structure in jungles.... it does weird things with vines trying to see how many are present.

Can I use this?

You are more than welcome to move along further with this concept in your datapacks, and incorporate code/ideas. All I ask is that you credit me and link here if you do so!

Feel free to comment any questions etc in the comments, and please let me know if you end up finding or using something useful here!
CompatibilityMinecraft 1.18
toMinecraft 1.19
Tags

2 Update Logs

Natural Plant Decay is out! : by kaimedina 04/04/2022 4:58:19 pmApr 4th, 2022

LOAD MORE LOGS

Create an account or sign in to comment.

FiyahKitteh
07/19/2022 11:09 am
Level 1 : New Miner
FiyahKitteh's Avatar
Hai!
So just making sure I have the instructions right.
I spawn a structure block, put it 2-4 blocks underground, name it KaiTower and turn the entities on, yes? Because if that's how it works, it keeps telling me that "KaiTower" is invalid. What am I doing wrong?
1
MrOminous
04/04/2022 1:58 pm
Level 61 : High Grandmaster Dwarf
MrOminous's Avatar
I love this idea, keep working on it!
2
kaimedina
04/04/2022 5:28 pm
Level 36 : Artisan Engineer
kaimedina's Avatar
I just uploaded a new pack based on foundations from this one! Natural plant decay :)
1
sigstop
04/01/2022 5:22 am
Level 2 : Apprentice Miner
sigstop's Avatar
A really cool concept, I would find it very useful in adventure/economy maps where player has to restore quest locations to progress, and not just clean up all the mobs that are present/collect X key items. Maybe someone could on that basis create zombiefied village restoration datapack, where by helping rebuild houses more and more villagers would come in.
2
Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome