#How can i give enchantments to mobs?

1 messages · Page 1 of 1 (latest)

mighty ore
#

I know about the tick stuff but i need an example of what to put on ''change_skeleton.mcfunction''

civic summitBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you

✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve

mighty ore
#

I get stucked trying to give a skeleton punch 10
i know punch 10 exists because i can /give it

mighty ore
#

like

#

when they spawn, with the tick function you can give them effects or attributes

#

i know that two

sick marlin
#

Do you want to summon a mob with an item or give an item in the mob's hand?

mighty ore
#

but i dont know how to make
example: all skeletons spawn with their bow with Punch 10

#

like the same weapon but with another enchantment

sick marlin
mighty ore
#

i cant enchant a mob with punch 10

#

it says that the limit is 2

#

but i know punch 10 exist in the game

sick marlin
#

ah, I see

#

Which version are you on?

mighty ore
#

1.20.4

sick marlin
#

data modify entity @s HandItems[0].tag.Enchantments append value {id:"minecraft:punch",lvl:10}

mighty ore
#

thats it?

sick marlin
#

hm yes

mighty ore
#

im gonna try it

#

niice it work

#

but wait

#

i have another question

sick marlin
# mighty ore im gonna try it

check the command if you remove 0 from [0] to change both hands

data modify entity @s HandItems[].tag.Enchantments append value {id:"minecraft:punch",lvl:10}

mighty ore
#

for example when a zombie hits you

#

it gives you nausea

#

I don't know if you understand what I'm saying

sick marlin
mighty ore
#

for example?

sick marlin
#

misode generator

mighty ore
#

i didn't know misode have that

sick marlin
mighty ore
#

and that would go to the tick function?

#

the code that misode give me

#

like this?

sick marlin
mighty ore
#

nope

sick marlin
#
{
  "criteria": {
    "requirement": {
      "trigger": "minecraft:entity_hurt_player",
      "conditions": {
        "damage": {
          "source_entity": {
            "type": "minecraft:husk"
          }
        }
      }
    }
  },
  "rewards": {
    "function": "namespace:name"
  }
}
#

@mighty ore

mighty ore
#

im here

mighty ore
#

I say it for the husk

weary prairie
#

you need to use /effect in the defined function for it to give hunger

sick marlin
# mighty ore that gives hunger?

as a reward, the function is called as and at a player, in the function you need to remove the advancement and you can give an effect with the command /effect

mighty ore
weary prairie
#

yea basically

mighty ore
#

and if i want to more people can take that effect

#

like everyone who get attacked

weary prairie
#

That's what it does

mighty ore
#

oh

#

i was thinking it just give it to the name

#

but what name can i put then?

weary prairie
#

nah

#

@s

#

@s specifies the current player

mighty ore
#

oh of course

#

and

#

then

#

remove the advancement?

#

why?

weary prairie
#

yea

mighty ore
#

i dont understand that part

weary prairie
#

so it can be triggered again

#

Because you cant get it again if you already have it

mighty ore
#

and whats the advancement?

#

what i have to

#

erase?

snow plankBOT
#
📂 Datapack Folderstructure
                .
                ├── pack.mcmeta
                ├── pack.png
                └── data
                    └── <namespace>
                        ├── advancements
                        ├── functions
                        ├── item_modifiers
                        ├── loot_tables
                        ├── predicates
                        ├── recipes
                        ├── structures
                        ├── chat_type
                        ├── damage_type
                        ├── tags 
                        │   ├── blocks
                        │   ├── entity_types
                        │   ├── fluids
                        │   ├── functions
                        │   ├── game_events
                        │   ├── items
                        │   ├── chat_type
                        │   └── damage_type
                        ├── dimension
                        ├── dimension_type
                        └── worldgen
                            ├── biome
                            ├── configured_carver
                            ├── configured_feature
                            ├── density_function
                            ├── noise
                            ├── noise_settings
                            ├── placed_feature
                            ├── processor_list
                            ├── structure
                            ├── structure_set
                            ├── template_pool
                            ├── world_preset
                            └── flat_level_generator_preset
                        ```
weary prairie
#

you put this in a .json file in the advancements folder

mighty ore
#

wow thats really useful

#

.json

#

like

#

creeper.json

#

pig.json

weary prairie
#

Yap

mighty ore
#

oh okay

#

but

weary prairie
#

call ir whatever you want

mighty ore
#

when someone gets hit

#

i have to enter the files?

weary prairie
#

Not quite sure whaz you mean

mighty ore
#

its a little stupid question but im really confused on that part

#

like

#

for example

#

im with my friend

#

and my friend get hurt by the mob that gives hunger

#

then i have to erase someting?

#

something*

weary prairie
#

no

#

after you created the advancement file

#

you also make a function

weary prairie
mighty ore
#

the name of the function is specific?

weary prairie
#

and in that function you make it remove the advancement from the player

#

yea

#

so the pack knows which function to call

weary prairie
#

yap

mighty ore
weary prairie
#

whatever you want to call it

mighty ore
#

oh okay

#

like

#

effecthurt.mcfunction

#

or something like that

#

?

weary prairie
#

yea for example

mighty ore
#

can you give me an example for the advancemnet revoke command?

#

I'm not very familiar with that

weary prairie
#

not 100% sure of the syntax

#

one secind

snow plankBOT
#
📜 /advancement

advancement (grant|revoke) <targets> everything

Adds or removes all loaded advancements.

advancement (grant|revoke) <targets> only <advancement> [<criterion>]

Adds or removes a single advancement or criterion.

advancement (grant|revoke) <targets> from <advancement>

Adds or removes an advancement and all its child advancements.

Think of specifying everything from that advancement to the end.

The exact order the operation is carried out in is specified advancement > child > child's child > ... When it operates on a child that branches, it iterates through all its children before continuing.

advancement (grant|revoke) <targets> through <advancement>

Specifies an advancement, and adds or removes all its parent advancements, and all its child advancements.

Think of specifying everything through the specified advancement, going both backwards and forwards.

The exact order the operation is as if the command were executed with "until" specified, then with "from" specified: parent > parent's parent > ... > root > specified advancement > child > child's child > ...

advancement (grant|revoke) <targets> until <advancement>

Adds or removes an advancement and all its parent advancements until the root for addition/removal.

Think of specifying everything from the start until that advancement.

The exact order the operation is carried out in is: parent > parent's parent > ... > root > specified advancement.

hushed void
#

advancement revoke @s only namespace:advancement

#

Where you replace namespace:advancement with your namespace and the name of the advancement file

mighty ore
hushed void
#

yep

ivory plinthBOT
#
advancement revoke @s only namespace:advancement_name
mighty ore
#

what would it be?

weary prairie
#

whatever you want to call it :P

#

the name of the json file

mighty ore
#

oooo okayokay

#

that one

#

allright im gonna try it

weary prairie
#

good luck :))

#

feel free to ask more questions in case it doesnt work!

mighty ore
#

okay okay thank you really much

weary prairie
#

Always happy to help :))

mighty ore
#

wait i get confused with something

#

on the advancements file

#

i put the .json

#

and the .mcfunction?

#

or I have to make a file to separate them?

#

@weary prairie

#

maybe i sleep soon if that happens i will come back

weary prairie
#

no both are seperate files

mighty ore
#

or You are saying that both are in the same file

weary prairie
#

qhat?

#

no

#

they are both

#

in different files

#

one in the advancements folder

#

the other one in the functions folder

mighty ore
#

oooo

#

there si a functions folder in the advancements folder

#

i missed that

sick marlin
#

lmao

mighty ore
#

XD

weary prairie
#

not in the advancements folder

#

besides it

weary prairie
#

Did you get it to work? :)

mighty ore
#

sorry it was too late when i was conected yesterday

#

i think im missing something

#

i put the stuff you told me but
What do you mean when you say use the /effect, so where do I have to put that?

sick marlin
#

just specify the path to the function

mighty ore
#

without the / i think

#

oh and how the game will know i want a spider gives that effect

#

the function

#

the json

weary prairie
#

Yap

weary prairie
#

the advancement shoudl be

#

papu:cavespider

mighty ore
#

oh okay

#

together?

#

well i suppose is separated

#

what are those points under the ''papu''?

weary prairie
#

yea

weary prairie
#

you need to

#

remoce the space

#

and the .json

mighty ore
#

like this?

weary prairie
#

yass

mighty ore
#

and how the game will know the mob i want to have this effect

#

this is the json

weary prairie
#

well

#

wait

#

yea

#

one sec

#
{
  "criteria": {
    "requirement": {
      "trigger": "minecraft:entity_hurt_player",
      "conditions": {
        "damage": {
          "source_entity": {
            "type": "minecraft:cave_spider"
          }
        }
      }
    }
  },
  "rewards": {
    "function": "papu:hurteffect"
  }
}
#

this should work

#

oh wait

#

nvm

weary prairie
#

"type": "minecraft:husk"

#

if you want a different entity you just need to change it

mighty ore
#

and its the same process if i want to make another mob with another effect when hits right?

weary prairie
#

yap

mighty ore
#

i will try it

#

Wait, did I have to put something in the tick.mcfunction?

weary prairie
#

nope

mighty ore
#

umm it didn't work

#

did i put something wrong?

weary prairie
#

in what folder

#

can you send the entire pack? :P

hushed void
#

Maybe try revoking the advancement manually, if you got it and didn't revoke it, you can't get it again

mighty ore
weary prairie
#

try revoking it in chat

mighty ore
#

it keeps just giving poision

#

poison

weary prairie
#

can you send the entire pack here

mighty ore
#

okay

#

like that?

#

when i try to send the file it says that i cant

weary prairie
#

yea that should work

#

lemme try

#

/advancement revoke @s only papu:cavespider

#

run this in chat

#

should fix it

#

that's also what gears said :P

mighty ore
#

it says that i dont have it

#

@weary prairie IT WORK

#

I JUST ERASE AND PUT AGAIN THE DATAPACK

#

thats strange

#

oh and i want to make a final question

#

how can i give to

#

for example

#

all drowned

#

a trident

#

i was thinking on the tick function but i suppose it will crash or something

#

Also it won't let me XD

weary prairie
#

wont happen again tho

civic summitBOT
#

Psst, <@&935561184806060073>!

weary prairie
#

ill have to leave for now maybe sb else can help with the ohter question :)

mighty ore
#

seriously thanks, I literally just made a wither zombie in 10 seconds with no difficulty

supple nebula
#

You can insert a trident in all untagged drowneds hands with the /item replace command

mighty ore
#

like this?

supple nebula
#

Use weapon.mainhand as the slot

mighty ore
#

oh okay

#

and i can put that on tick.mcfuction?

supple nebula
#

I don't recommend this. Do it similar to the ghast. Otherwise it will replace every drowned hand item with a trident every tick. Even if they already have a trident.

#

This can potentially cause a lot of lag

mighty ore
#

oh okay

#

like this?

mighty ore
#

lol it work

#

/resolved

#

uhh

#

i dont remember that command

civic summitBOT
# civic summit <@&1201956957406109788>
Question Closed

Your question, #1240959831217541171 (How can i give enchantments to mobs?), was resolved!

Original Message

#1240959831217541171 message

Duration open

1d1h42m