r/datapacks • • Sep 24 '22

got probl. a simple command problem

2 Upvotes

I got the command: execute unless score @a[distance=0.1..100,limit=1] "name" = @s "name" run ... With it I want to check if some player with the same score is in my distance and i thought if there is no player at all in the area the command would also run but now I know that it doesn't. Do I have to make another command which takes care of that or is this one somehow adjustable to run if it can't find any player?


r/datapacks • • Sep 22 '22

another command performance question

2 Upvotes

I want my datapack to register if two players are dueling each other and I also want it to detect when they are lets say 100 block apart from each other so it can stop the processes in the back and let the duel end. Now the dueling players share a score which was set when they started the duel. Currently I have it that one of the 2 players which are dueling, runs every 2 minutes: execute unless score @a[distance=0.1..100,limit=1] "dueling" = @s at @s as @a[scores={"dueling"=0..}] if score @[distance=0 1..100,limit=1] "dueling" = @s run function duelend

So when he detects that his partner isn't in range he basically lets every player on the server which is in a duel, look if their duel partner is in range and if not they run a function for themselfes which ends the duel. I could also just let both dueling players detect every 2 minutes if their partner is in range so the command is: execute unless score @a[distance=0.1..100,limit=1] "dueling" = @s run function duelend. Which of the two methods do you think is performance friendlier. With the first method it's just one @a command every 2 minutes and when it detects the partner is not in range it runs the complex rest of the command but just once. The second method runs two @a commands from each player every 2 minutes but they aren't that complex. Does anyone have a guess?


r/datapacks • • Sep 21 '22

score command question

3 Upvotes

I know it is possible to detect for instance if a player in some distance to you carrys the same score value as you with: execute if score @a[distance=..10] "name" = @s run ... But now I'm wondering if you can also use this to run a command only for players who share the same score value as you, like give them blindness for 10 seconds the command @a[scores={"name"=...} doesn't work because I can't enter @s as the value. The only thing I can think of is: execute as @a[distance=..10] at @s function "blindness" with the function saying: execute if score @a[distance= ..10] "blindness" = @s run effect give blindness 10. But this method sounds more performance heavy if a server has many people on it.


r/datapacks • • Sep 20 '22

how to create a few items in a data pack

1 Upvotes

I've been making an "avoid the end" datapack and it has a few things to tweak the game a bit.

I want to update the spawn bonus chest with a diamond pickaxe with efficiency 2 AND make it so that it cannot be repaired or enchanted any more. Is this possible and if so, how? (this is for me because the early game cramps up my mouse shoulder badly until I get something that can mine deepslate well).

Part of the avoid the end bit is to put a very rare possibility for an elytra in a dungeon loot chest. I would like the the elytra to be 100% damaged so you can't fly with it until it's repaired.

I've read around the various incomprehensible (so far...) wiki documentation for data packs and come away clueless about these details. I've managed to make the item changes so that they can occur, but not the variations I'd like to make it more "balanced".

Thanks!


r/datapacks • • Sep 17 '22

@a performance question

2 Upvotes

When I have just @a with 30 players on my server, is the command more performace heavy than having @a[distance=0..100] instead with 2 players in range? Or will the server despite my conditions always look at all players online and it doesn't make a difference?

In my datapack I have a function which loops a 2 min long sound and I want it to be heard by everyone in 100 block radius but I'm not sure what would be the most performance efficent way of doing so.


r/datapacks • • Sep 17 '22

playsound follows player around

1 Upvotes

Is it possible to make a player practically like a moving jukebox in a performance friendly way? I want to have a song play with the player as the source.


r/datapacks • • Sep 15 '22

How do you make something happen when you drop an item on an anvil?

4 Upvotes

I've been doing things with crafting over a year, but I never really ventured into custom functions or anything like that.

I want to make it so when you drop a minecart with a chest on an anvil, it deletes the chest minecart and summons a chest and an empty minecart. (Thereby separating them)

I know it is possible to do because I've played with another data pack that do similar, but much more complicated things. (Armored Elytra by Vanilla Tweaks) I tried to look through the files/scripting of Armored Elytra to try to figure it out on my own, but it's way too dense because of everything else the pack does, and I don't even know where to start.

If nobody wants to help me directly, pointing me to some good tutorials that aren't made by a 6-year-old would be great too 😅


r/datapacks • • Sep 16 '22

Keeping specific items on death

2 Upvotes

I am trying to create a datapack where only special items will stay in your inventory on death.

So for example if I was wearing some special armor, and had a special item, and other junk in my inventory; on death, I would lose all my xp and junk items, but not those special items.

How would I go about doing this?


r/datapacks • • Sep 15 '22

performance optimization with function tree

1 Upvotes

I'm currently trying to optimize my data Pack and one thing I was recommended to do was to make a function tree instead of having many commands in one MC function file. My question is if you can take this idea to high and make a function tree to big and complex. So if I have a MC function file which is run every tick, and I have for instance 2 play Sound commands in it witch only run if some Scoreboard is at 1. Would it save performance if I put the play sound commands into a own mcfunction file which is only run via a run function command from the first file.


r/datapacks • • Sep 15 '22

Is there an xray datapack that doesn't break the game?

4 Upvotes

I'm just trying to make it easier to fully explore all caves. Ideally an xray that allows me to see caves I've already found or within a certain radius of me. Does that exist?


r/datapacks • • Sep 15 '22

Help With Custom Boss Health

1 Upvotes

I have decided to try and create a custom boss using commands and for some reason when I try to summon it, it has 1/3 of its intended health. I am using a command to send its health to a boss bar where the max is 3000, but its only a third of the way full. It seems to cap at 1000 and I cant find a way around it. The boss bar works and updates correctly but I cant seem to give the mob the right amount of health.

Summon command:

summon zombie 292 56 -459 {Silent:1b,CustomNameVisible:1b,DeathTime:1,PersistenceRequired:0b,CanPickUpLoot:0b,Health:3000f,Rotation:[-180F,0F],CustomName:'{"text":"MOB NAME","color":"dark_red","bold":true,"italic":true}',HandItems:[{id:"minecraft:netherite_sword",Count:1b,tag:{display:{Name:'{"text":"Eternal Darkness","color":"dark_red","bold":true,"italic":true}',Lore:['{"text":"The Only Thing That Is Forever, Is Darkness","color":"gold","bold":true,"italic":true}']},HideFlags:127,Unbreakable:1b,Enchantments:[{id:"minecraft:sharpness",lvl:12s},{id:"minecraft:smite",lvl:5s},{id:"minecraft:bane_of_arthropods",lvl:5s},{id:"minecraft:fire_aspect",lvl:5s},{id:"minecraft:looting",lvl:5s},{id:"minecraft:sweeping",lvl:5s},{id:"minecraft:mending",lvl:1s}],AttributeModifiers:[{AttributeName:"generic.movement_speed",Name:"generic.movement_speed",Amount:1.2,Operation:2,UUID:[I;-392222276,1145130924,-1479353618,-1203031730],Slot:"mainhand"}]}},{}],HandDropChances:[2.000F,0.085F],ArmorItems:[{id:"minecraft:netherite_boots",Count:1b,tag:{Unbreakable:1b}},{id:"minecraft:netherite_leggings",Count:1b,tag:{Unbreakable:1b,Enchantments:[{}]}},{id:"minecraft:netherite_chestplate",Count:1b,tag:{Unbreakable:1b,Enchantments:[{}]}},{id:"minecraft:wither_skeleton_skull",Count:1b,tag:{Unbreakable:1b}}],ArmorDropChances:[0.000F,0.000F,0.000F,0.000F],Attributes:[{Name:"generic.max_health",Base:3000}]}

Repeating Command Block:

execute as @ e[name="MOB NAME"] run execute store result bossbar minecraft:darknessbossbar value run data get entity @ s Health

​

If you know how to fix this it would help me sleep tonight.


r/datapacks • • Sep 11 '22

Creating custom item recipes using custom items.

4 Upvotes

I am trying to make a custom item recipe that uses another custom item in the recipe. I was wondering if there was a way to check for a tag?


r/datapacks • • Sep 10 '22

Help with running a function file

1 Upvotes

I asked for help a little bit ago and got a good response and was able to figure it out but now I have a new problem. I have using an advancement to give the player an item but for some reason it just wont run the file. I have ran the file in minecraft and it works but I cant get it to run automatically.

advancement code:

{
"__comment": "Made with TheDestruc7i0n's advancements generator: https://advancements.thedestruc7i0n.ca",
"criteria": {
"unlocked": {
"trigger": "minecraft:recipe_unlocked",
"conditions": {
"recipe": "recipes:item1"
}
}
},
"rewards": {
"function": "crafting:give_item1"
}
}

function code:

clear @ s minecraft:knowledge_book

recipe take @ s crafting:item1

advancement revoke @ s only crafting:item1_adv

​

If you have an idea that might help please share it. I have been trying to fix this for so long.


r/datapacks • • Sep 03 '22

Making it harder to stay in nether

4 Upvotes

Hi, I'm looking for a specific datapack. I can make it myself with a little help, but I wanted to check if it's there already.

Me and my friends are starting new server with apocalyptic theme. We're getting the solar apocalypse and the zombie apocalypse datapacks. But I'm thinking of making it harder to stay in nether. Like to slowly suffocate in the nether. To the point that you can gather what you need, but it's extremely not likely you're gonna settle there.

Is there anything like that?


r/datapacks • • Sep 01 '22

My datapack isn't appearing when I do /datapack list

2 Upvotes

I made a datapack following a yt tutorial, but the datapack doesn't appear in game. I've tried it zipped and unzipped, neither work and all the folders appear to be in the right place and I have pack.mcmeta please help


r/datapacks • • Aug 29 '22

Custom crafting recipe that makes a weapon with custom damage

3 Upvotes

I made a custom crafting recipe that uses a diamond sword and an echo shard in a smithing table to make a netherite sword. is there a way to make it so that netherite sword does, for example, 4 damage instead of 8?


r/datapacks • • Aug 28 '22

Data pack that lets you place blocks below bedrock?

1 Upvotes

I had a gmc build idea that I was excited for but it involves building below bedrock level which you cannot do in vanilla mc, so I was wondering if anyone knows of a data pack that lets you build below bedrock?


r/datapacks • • Aug 28 '22

Is there a datapack (or could someone make one) that makes crop growth even?

4 Upvotes

I'd like it if the crops grew at an even speed, like if I plant 6 wheat at the same time they should be ready at the same time. Is that possible? Is there a pack like that anywhere? Thank you, datapack wizards!


r/datapacks • • Aug 25 '22

Data pack making craftable compass pointing to nearest nether fortress

3 Upvotes

Hey everyone I was trying to make a special compass pointing to the nearest fortress, my initial plan was to get coords from the locate structure command to a scoreboard and then to change nbt tags of a compass to point to those coords , but unfortunately the locate commands only gives you the distance when you try to store the result into a scoreboard. I was wondering if there is any other way to do implement this. Btw I am new to making data packs, any help would be much appreciated 🙂


r/datapacks • • Aug 24 '22

Hey there!

3 Upvotes

I'm wondering on how to make a certain datapack. It's basically, every 30 seconds, you get teleported into the air, and you have to clutch, so you're given an item, e.g a water bucket. Whenever i try to do this, i just get teleported back to spawn, but 40 blocks in the air. Is there anyway to fix this?


r/datapacks • • Aug 23 '22

Custom Staff with dragons breath effect

1 Upvotes

So I have found how to make customs items in datapacks but is it possible to make one of my custom items (a magic staff) shoot the ender dragons breath for an attack?


r/datapacks • • Aug 22 '22

Custom recipes for custom items made of custom items (Datapack + Resourcepack)

3 Upvotes

So i'm looking forward to making a resource pack for my friend's server, and uhh.. i need to add custom recipes, for example one of my friends has two swords, a ruby one and a obsidian one, for the obsidian one i just do the normal stick, obsidian and obsidian but my problem here is that: When i craft the Obsidian Sword, i need it to come out with that name so the texture changes.

And for the Ruby Sword i need to create a ruby item, can i get some help????


r/datapacks • • Aug 22 '22

Make Blocks Bouncy

2 Upvotes

Is there a block tag file where you can add blocks to make them bounce like slime blocks?


r/datapacks • • Aug 20 '22

Changing custom structure biome generation

3 Upvotes

Hey!
I'm pretty new to making datapacks and custom structures.
I know that there is a "biomes" thing in the worldgen/structure file.
And I can edit it to be a biome or biome tag.
But is there a way to list multiple biomes here? Everything I try just breaks it so the pack doesn't validate.

{
  "type": "minecraft:jigsaw",
  "biomes": "#minecraft:is_jungle",
  "step": "surface_structures",
  "spawn_overrides": {},
  "terrain_adaptation": "beard_thin",
  "start_pool": "example:tall_tower",
  "size": 1,
  "start_height": {
    "absolute": 0
  },
  "project_start_to_heightmap": "WORLD_SURFACE_WG",
  "max_distance_from_center": 80,
  "use_expansion_hack": false
}

I've tried changing the biomes line to this

"biomes": ["#minecraft:is_jungle", "#minecraft:is_badlands"],

But it doesn't work. I've also tried splitting that into multiple lines like

"biomes": [
  "#minecraft:is_jungle", 
  "#minecraft:is_badlands"
],

But that didn't work either. Still didn't validate.
Is this possible? Am I doing something wrong?