#Random Help questions

1 messages · Page 1 of 1 (latest)

stoic hamlet
#

this threw the error unknown "if" command so its trying to register the if statement as a minecraft command and i'm not sure how to stop it from doing that and run the effect command i had listed (i don't have the most knowledge on js)

#

the full file

brazen copper
#

Hasitem={item=ricky:dirt_wand}

stoic hamlet
brazen copper
#

I really don't understand what use a /testfor has in a function, you should delete it

#

You can also add a target to playsound like @s or @p

#

Tp @s ~ ~26 ~ 0 0 true

stoic hamlet
stoic hamlet
brazen copper
stoic hamlet
#

i havent used functions yet im still looking in the documentations and everythingfor it

stoic hamlet
stoic hamlet
#

okay update

#

i figured out a little bit and got it to work properly

vivid cosmos
#

You can just condense it into a effect command

stoic hamlet
#

i did

#

but i did run into another issue if you dont mine sticking around rq

#

this item wont go into offhand slot

#

but it should be able to, do you got any idea why it wont?

vivid cosmos
# stoic hamlet i did

Yeah no this isn't optimal, you can just do it in one singular file and it's way shorter. /effect @e[type=player,hasitem={item=ricky:dirt_wand,location=slot.weapon.offhand}] speed 5 2 true

stoic hamlet
#

oh shit okay

#

well idk how to feel about how i just spent hours of my time but thanks

vivid cosmos
stoic hamlet
vivid cosmos
stoic hamlet
#

ah okay

#

i didnt realize you could do that

stoic hamlet
#

ahh it was mainhand

#

but the / before effect was the issue

vivid cosmos
#

Or just the autocomplete

stoic hamlet
#

if you want it in an equipment slot it needs that and technically offhand is an equipment slot

stoic hamlet
vivid cosmos
stoic hamlet
stoic hamlet
#

@e def serves a purpose tho for other entities

stoic hamlet
# vivid cosmos Glad it's working for you now, if you have a command related question you can pi...

if you wanted to detect when an entity has been hurt how would you do that? my thoughts are an entity gets hit then spawns other entities using the "minecraft:spawn_entity": {
"entities": [
{
"min_wait_time": 0,
"max_wait_time": 0,
"spawn_entity": "trader_llama",
"spawn_event": "minecraft:from_wandering_trader",
"single_use": true,
"num_to_spawn": 2,
"should_leash": true
}
]
}, component but im not even sure if the component can be used the sane

#

same*

brazen copper
stoic hamlet
#

that was an example component but yes it would spawn 2 each time its hurt , and yes that math does up but my entity only has 5hp so it wont be as many

stoic hamlet
brazen copper
#

Ok, if that's not a problem then you just need to run the event with
"minecraft:on_hurt" : {"event": "spawn_llama"}

stoic hamlet
#

how would i declare my entity as being hurt tho?

#

ik that on hurt detects when the hurt occurs but i couldnt find any documentation showing entity hurt

brazen copper
#

"minecraft:on_hurt" : {"event": "spawn_llama"} It is an e component, that detects when the entity is hit

stoic hamlet
#

ive got this event entity @e[type=ricky:ricky:dirt_man] minecraft:on_hurt_event

#

using a function file

#

how would i detect the onhurtevent was done by a player?

brazen copper
#

"minecraft:on_hurt_by_player"

stoic hamlet
#

ah okay i didnt know if there was a specific array needed or what, thanks

brazen copper
stoic hamlet
#

im confused so i got this how do i give it the spawn component?

#

i thought spawn wouldve been summon

brazen copper
#

mmm no

stoic hamlet
brazen copper
#

You are supposed to be configuring your entity, not commands.

stoic hamlet
#

i can add the on hurt by player to my entitys json?

brazen copper
#

yes

stoic hamlet
#

ahh

#

last time i just summoned 2 more on a leash eachtime they spawned so they duplicated and killed a workd

stoic hamlet
brazen copper
#

put it in components

stoic hamlet
#

it was

#

it wasnt in comnponent groups

#

this is how the normal component looks

stoic hamlet
brazen copper
#

minecraft:on_hurt is wrong, you must put it in "components"

stoic hamlet
brazen copper
#

and the minecraft:spawn_entity component should be in a component group
"component_groups": {
"spawn_example": {
"minecraft:spawn_entity": {}
}
},

stoic hamlet
brazen copper
#

show me, it shouldn't cause error

stoic hamlet
stoic hamlet
#

im 99% sure those dont go in comonent groups

brazen copper
stoic hamlet
#

cause it was working fine in normal component

stoic hamlet
brazen copper
#

Ah, I see your confusion.

stoic hamlet
#

if you look there itll show you that it goes in normal components

brazen copper
#

I am referring to these groups

stoic hamlet
#

and it caused errors

brazen copper
#

"component_groups": {
"spawn_example": {
"minecraft:spawn_entity": {}
}
},

stoic hamlet
#

being put in the "components" it doesnt cause any errors and runs the spawning functions

#

function*

brazen copper
#

Wouldn't you rather send the code? I feel like we would save a lot of time.

stoic hamlet
#

i don't see how id learn from that, i don't think the component is the correct one anyways it doesn't get used in a component group like you say its used in the normal components and the errors spoke that for themselves on that one. if youd like to try yourself you can

#

{
"format_version": "1.19.80",
"minecraft:entity": {
"description": {
"identifier": "ricky:dirt_man",
"is_spawnable": true,
"is_summonable": true,
"is_experimental": false
},
"components": {
"minecraft:on_hurt_by_player" : {"event": "spawn_ricky:dirt_man" } ,
"minecraft:type_family": {
"family": [
"test",

      "mob",
      "animal"
      
    ]
  },
  
  
  "minecraft:loot": {
    "table": "loot_tables/DirtMan/lootx.json"
  },
  "minecraft:experience_reward": {
    "on_death": "q.last_hit_by_player ? 0 : 0"
  },
  "minecraft:health": {
    "max": 5,
    "value": 5
  },
  "minecraft:movement": {
    "value": 0.3
  },
  "minecraft:annotation.open_door": {
  },
  "minecraft:movement.basic": {},
  "minecraft:navigation.walk": {
    "can_path_over_water": true,
    "can_pass_doors": true,
    "can_open_doors": false,
    "avoid_water": true,
    "avoid_damage_blocks": true,
    "can_jump": true,
    "can_float":true,
    "can_walk_in_lava": false,
    "can_sink": false
   },
#

/"minecraft:spawn_entity": {
"entities": [
{
"min_wait_time": 0,
"max_wait_time": 1,
"spawn_entity": "ricky:dirt_man",
"spawn_event": "on_hurt_by_player",
"single_use": true,
"num_to_spawn": 1,
"should_leash": false
}
]
},
/
"minecraft:physics": {},
"minecraft:breathable": {
"total_supply": 15,
"suffocate_time": 0
},
"minecraft:pushable": {},
"minecraft:behavior.float": {
"priority": 0
},
"minecraft:behavior.random_stroll": {
"priority": 2,
"xz_dist": 15
},

  "minecraft:behavior.look_at_player": {
    "priority": 10
  },
  "minecraft:behavior.random_look_around": {
    "priority": 1
  },
  
  "minecraft:trade_table": {
    "display_name": "Dirt Man",
    "new_screen": true,
    "table": "trading/DirtMan/tradex.json"
  },
  "minecraft:behavior.look_at_trading_player": {
    "priority": 0
  },
  "minecraft:behavior.trade_with_player": {
    "priority": 2
  },
  "minecraft:behavior.trade_interest": {
    "priority": 5,
    "within_radius": 3,
    "interest_time": 45,
    "remove_item_time": 1,
    "carried_item_switch_time": 2,
    "cooldown": 2
  }
},
"component_groups": {
  "test:despawn": {
    "minecraft:instant_despawn": {}
  }
  
},
"events": {
  "test:despawn": {
    "add": {
      "component_groups": [
        "test:despawn"
      ]
    }
  }
}

}
}

#

had to split into 2 cause i dont have nitro

#

once you remove the mulit line comment they start spawning on themselves

#

if you set that number to 2 or 3 your world gets laggy cause they spawn alot

#

cant use the on_hurt_by_player sadly it doesnt work it needs spawnrules like a raid or wandering trader spawn or such

brazen copper
stoic hamlet
#

component groups is supposed to be an array it says

#

meaning []

#

switching it to an array gives these errors aswell

brazen copper
#

I don't understand, I've already sent you the fixed file

stoic hamlet
#

minecraft spawn entity doesnt go in component groups im tryna tell you

brazen copper
# brazen copper

bro that's not what I sent, you have you seen the code I sent?

stoic hamlet
#

i copied it over

#

from what you sent

stoic hamlet
#

from before i edited it

stoic hamlet
# stoic hamlet

then i made it an array to fix that first error and it had these errors

brazen copper
#

Just copy and paste everything I sent

stoic hamlet
#

ahh i missed the "22 lines left" i didnt donwlod just copied mb it did work

#

but why does that work?

#

"component_groups": {
"spawn": {
"minecraft:spawn_entity": {
"entities": [
{
"min_wait_time": 0,
"max_wait_time": 1,
"spawn_entity": "ricky:dirt_man",
"single_use": true,
"num_to_spawn": 1,
"should_leash": false
}
]
}
},
"test:despawn": {
"minecraft:instant_despawn": {}
}
},
"events": {
"spawn_ricky:dirt_man": {
"add": {
"component_groups": [
"spawn"
]
}
},
"test:despawn": {
"add": {
"component_groups": [
"test:despawn"
]
}
}

#

why does that work?

brazen copper
#

This is how it should be

stoic hamlet
#

yeah but i wanna know why so i can do it again on my own when i need to

#

im new to this i dont just want solutions i wanna learn how

#

i appreciate it 100% just not learnin a whole lot

brazen copper
#

mmm follow the path first on_hurt_by_player -> event -> component_group

#

Your entity has 3 important parts, components, component groups and events

stoic hamlet
#

i understand thats the order but how does the component groups work? how do i create my own and actually understand them?

brazen copper
#

The components are like the default configuration, it will always be active

#

Component groups are isolated components, they can be added and removed through events

#

Events have several functions, although in this case they were used to add components group, you can also use the /event command to make it work, but usually these events are activated from the "component" section as in this case, we use on_hurt_by_player

#

This would be the summarized version

stoic hamlet
brazen copper
#

Yes, events are just waiting to be called, either by a component or an /event command.

stoic hamlet
#

ah alright, and the component group string?

brazen copper
stoic hamlet
#

i meant lower than that

#

this is the "spawn" inside component groups the command being ran? or how is string found?

#

ig its in events

#

sorry

brazen copper
#

I don't know what you mean, I think the image explains it well

#

If you don't like "spawn" you can change it

stoic hamlet
brazen copper
#

yes

stoic hamlet
#

ohhh okay

#

so you just write the event you want to call then give a component group a name then you call the component you want to call using that name

#

thanks , i dont have alot of js experience so its a bit difficult to understand some aspects but i do appreciate the help

brazen copper
#

Ok, I also recommend you to use a more updated version like 1.20.80 and not 1.19.80, since some components could be obsolete

stoic hamlet
#

i think i chose that version cause of deprected stuff before but im not sure, theres no errors using 1.20.80 so ill use that i forgot about that ngl;

#

do you know if the spawn_entity also works with spawning raw items?

#

ig i can test that act

brazen copper
#

"minecraft:spawn_entity": {
"entities": [
{
"min_wait_time": 0,
"max_wait_time": 1,
"spawn_item": "diamond",
"single_use": true,
"num_to_spawn": 1,
"should_leash": false
}
]
}

#

?

stoic hamlet
#

oh you dont need the identefier?

#

oh its spawn item

brazen copper
#

For vanilla entities and vanilla items it is not necessary

stoic hamlet
#

instead of entity

stoic hamlet
#

ive been adding it to everything ;-;

brazen copper
#

Well it doesn't make much difference

stoic hamlet
#

nope just extra typing, do you know of any ways to combine spawns item and spawn entity?

#

without making 2 seperate component groups

#

ex. having it spawn an entity aswell as an item

#

i feel like that just needs a seperate component group

brazen copper
stoic hamlet
#

it only spawns them

#

the entities

#

no items

brazen copper
#

mmm then it is necessary to use 2 separate groups

brazen copper
stoic hamlet
#

thats what i was thinking i tried to one for each it just doesnt load it properly

#

ima make a second group rn

brazen copper
#

have you done it like this?

stoic hamlet
#

i did the "component_groups "spawn_stick etc.." but the events part i was unsure how to do it

#

i was about to ask

#

thats so cool wtf

#

so it works with just any component?

#

or any entity component

brazen copper
stoic hamlet
#

this is using the spawn_entity component

brazen copper
#

Do you mean more different entities and more different items? Yes, it is possible, I think so.

#

Usually some components cannot be executed at the same time, did it work correctly for you? Did the entity and items appear?

stoic hamlet
#

hm i think were thinking differently

stoic hamlet
#

"minecraft:behavior.panic": {
"priority": 10,
"speed_multiplier": 1.0
},

#

if i want it to panic and run around when hit i can replace the spawn_entity with that component cant i?

#

thats what i mean hy the question

#

or this "minecraft:health": {
"value": 20,
"max": 20
},

#

example values^

brazen copper
#

Ah, I understand now, yes, you can use any component, that is the function of the component group, you can add any type of component isolated from the "components" section.

stoic hamlet
#

ohh okay thats awesome

stoic hamlet
#

since the value is 20 if i smack it and it goes to 13 then itd just reset to 20 again wouldnt it?

brazen copper
#

mmm not sure if that works like that, never used it to regenerate health

stoic hamlet
#

hmm lemme test it then

brazen copper
#

maybe it works

stoic hamlet
#

doesnt

brazen copper
#

although if you wanted you could add a regeneration function, or simply nullify the damage with the damage_sensor component
"spawn_ricky:dirt_man": {
"queue_command": {
"command": "effect @s regeneration 2 10 true"
},
"add": {
"component_groups": [
"spawn_dirt_man",
"spawn_stick"
]
}
},

stoic hamlet
#

actually i think it hurts it if anything

stoic hamlet
brazen copper
#

but you can combine the health component with the regeneration effect

stoic hamlet
#

before hand it was spawning both the item and the mob now its only spawning the item for some reason

#

hm

brazen copper
stoic hamlet
#

"component_groups": {
"spawn_dirt_man": {
"minecraft:spawn_entity": {
"entities": [
{
"min_wait_time": 0,
"max_wait_time": 1,
"spawn_entity": "ricky:dirt_man",
"num_to_spawn": 2,
"single_use": true,
"should_leash": false
}
]
}

        },
  "spawn_Stick":{
    "minecraft:spawn_entity": {
                "entities": [
                    {
                        "min_wait_time": 0,
                        "max_wait_time": 1,
                      "spawn_item": "stick",
          "num_to_spawn": 16,
                        "single_use": true,
                        "should_leash": false
                    }
                ]
            }},
    "health":{
      "minecraft:health": {
        "value": 20,
        "max": 20
      }

    },
        "test:despawn": {
            "minecraft:instant_despawn": {}
        }
    },
    "events": {
        "spawn_ricky:dirt_man": {
            "add": {
                "component_groups": [
                    "spawn_dirt_man",
        "spawn_Stick",
        "health"
                ]
            }
        },
  
        "test:despawn": {
            "add": {
                "component_groups": [
                    "test:despawn"
                ]
            }
        }
    }
#

i removed health since then

brazen copper
#

ok, isee

stoic hamlet
#

when removing the sticks one it does spawn

#

odd

brazen copper
#

Your component group has a capital letter, "spawn_stick" is not equal to "spawn_Stick"

stoic hamlet
#

it works

#

theyre the same im not sure what you mean by that

brazen copper
stoic hamlet
#

i think its just trying to do the same spawn entity component and thats caus9ing issues like you said earlier

#

still was working fine till i tested the health so maybe its just a touchy subject

brazen copper
#

Yes, I thought it was a special case when you said it worked correctly, you tried with a new entity

stoic hamlet
#

do you know if its possible to add a specific item being in the mainhand to the component "minecraft:on_hurt_by_player"? or will i need to make a function for that?

#

oh wait

stoic hamlet
#

thats just hasitem isnt it?

#

hasitem={item=ricky:dirt_wand,location=slot.weapon.offhand} example

#

would that work for it?

brazen copper
stoic hamlet
stoic hamlet
brazen copper
#

"minecraft:on_hurt_by_player": {
"event": "spawn_ricky:dirt_man",
"filters": [
{
"any_of": [
{
"test": "has_equipment",
"value": "stick",
"subject": "other",
"operator": "==",
"domain": "hand"
}
]
}
]
}

stoic hamlet
#

ahh the filters go after the event

#

i put them after the ":" on hurtbyplayer":"

stoic hamlet
brazen copper
#

simply the location of the item

stoic hamlet
#

ah okay

stoic hamlet
#

ive got that open

#

its been a long ass day

brazen copper
stoic hamlet
#

ohhh so thats the same as slot.weapon.mainhand

#

just with less info required

#

i like that

stoic hamlet
brazen copper
stoic hamlet
brazen copper
stoic hamlet
#

there she is

brazen copper
#

although I'm not sure

stoic hamlet
#

so ive got this

#

but with this it doesnt work at all, with the item or with my hand

#

not sure why tho i followed the documentaiton and double checked w yours

#

double checking now tho

#

changing the item doesnt help either just attempted that

brazen copper
#

Ok, in that case we can try another way.

#

you have to put the filter on the event

stoic hamlet
#

okay ill try that rq

brazen copper
#

no, better try this
"minecraft:on_hurt_by_player": {
"event": "spawn_ricky:dirt_man",
"filters": {
"any_of": [
{
"test": "has_equipment",
"value": "stick",
"subject": "other",
"operator": "==",
"domain": "hand"
}
]
}
}

stoic hamlet
#

i did this and it works when any item is used

#

oh shit

#

using "any_of" lets it work regardlesss of the item since we have the domain as hand

#

anything in my hand will run it

#

maybve all of would worked better

brazen copper
#

I have removed [ ] that may have caused an error

brazen copper
#

This only refers to filters that are within any_of or all_of

stoic hamlet
#

oh any would refer to other tests

#

like has_biome_tag or some random test

stoic hamlet
#

im using stick aswell

#

for the item

brazen copper
#

ok then we will try with events, delete the filter from the on_hurt_by_player component

#

"spawn_ricky:dirt_man": {
"sequence": [
{
"filters": {
"all_of": [
{
"test": "has_equipment",
"value": "stick",
"subject": "other",
"operator": "==",
"domain": "hand"
}
]
},

                "add": {
                    "component_groups": [
                        "spawn_dirt_man",
                        "spawn_Stick"
                    ]
                }
            }
        ]
    },
stoic hamlet
#

sequence just makes it go in right?

#

doesnt work still

#

i wonder if equipment is refering to a tool

brazen copper
#

ricky:dirt_wand

stoic hamlet
#

ive swapped it to different items including stick and dirt

brazen copper
#

ok

stoic hamlet
stoic hamlet
brazen copper
#

ok then we will use damage sensor, that should not fail

stoic hamlet
#

okay

brazen copper
#

Remove all the filters and now I'll send you what the damage sensor should look like.

#

change the on_hurt_by_player component to this
"minecraft:damage_sensor": {
"triggers": [
{
"on_damage": {
"event": "spawn_ricky:dirt_man",
"filters": [
{
"all_of": [
{
"test": "is_family",
"value": "player",
"subject": "other"
},
{
"test": "has_equipment",
"value": "stick",
"subject": "other",
"operator": "==",
"domain": "hand"
}
]
}
]
}
}
]
},

stoic hamlet
#

that one worked

#

i def needa work with filters more, i undestood writing it out apart from where the filters go, ig those just stay in the conditions or whatever

#

that one worked but back to the issue of it only drops sticks

#

no spawning

#

they are still seperated into different component groups aswell

brazen copper
stoic hamlet
#

it did

#

i think ik whats happening

#

its only doing the last listed under component groups

brazen copper
#

has it been proven that a new entity has been invoked?

stoic hamlet
#

if i swap them it only does the 2nd one

stoic hamlet
stoic hamlet
#

the sticks spawn with this

#

its like only reading the last section of the array i wonder if i need to add {} between the strings

#

like {spawn_dirt_man},{spawn_Stick}, etc

brazen copper
#

I mean you create a new dirt_man

#

spawn a new dirt_man and try

stoic hamlet
stoic hamlet
#

simple fix would be to make a different item spawn the sticks but itd be neat if its posible to do both with one item

brazen copper
#

Yes, it is possible, I just wanted to rule out a theory, in that case we will use a timer

stoic hamlet
#

bet okay whats that

#

apart from a timer

#

oh shit can you give it a timer to activate the 2 different events one after another? instead of attempting it all together?

brazen copper
#

although before that, do you think it would be a good option to use a summon command? I know there could be some problems like the summoning inside side blocks, but if you don't mind it might be easier for you

stoic hamlet
#

they naturally spawn and i have a recip[e for the spawn eggs so in the actual finish product it wouldnt be using a summon command but we can try anything im learnin alot

brazen copper
stoic hamlet
#

but thats not how id prefer it

brazen copper
stoic hamlet
#

so "time_down_event" is what makes it wait a second

#

is there any other choices for that?

#

and does the timer need to be in component groups? what all can that be used for? just anything?

brazen copper
#

0.1 seconds

stoic hamlet
#

says that for all of them with yellow under it

brazen copper
#

You can use the components in "components" or "components_group" there is no limit for that, the timer component is just one more

brazen copper
stoic hamlet
#

none got parsed either so its not vsc

brazen copper
#

mmm it's probably changed in the new version

stoic hamlet
#

okay ill look at documentation maybe its updated

brazen copper
#

oh no, isee

stoic hamlet
#

"minecraft:timer":{
"looping": true,
"randomInterval":true,
"time": [0.0, 0.0],
"time_down_event": {
"event":"minecraft:times_up"
}
}

#

thats from documentation

brazen copper
stoic hamlet
#

what was the issue?

brazen copper
#

You have placed the timer component wrong

stoic hamlet
#

ohh i didnt put it in the spawn entity command

#

component

brazen copper
stoic hamlet
#

yeah when its supposed to be in the spawn entity

#

oh i think im just reading it weird

#

that worked

#

damn this isnt as complicated as it seems

#

still difficult asf but wow

brazen copper
#

Yes, it is not, at least in entities things are simpler and have a certain logic that is easy to understand.

stoic hamlet
#

what was spawn_ricky:stick in my other file?

#

oh spawn_Stick

#

oh thats just a new event? im confused

brazen copper
#

new event

stoic hamlet
#

ohh

#

so what that does is removes the group spawn dirt man

#

then it gets spawn_Stick so that it can do the other event

#

it just took me a min to actually read the stuff ;-;

#

so how does this work?

#

the timer in particular

brazen copper
brazen copper
stoic hamlet
#

the timer is confusing me

#

it has a 0.1 delay but what event is that timer effecting?

#

its calling on the event to remove the dirt man group and add stick group

#

but the even right after the timer is spawn_Stick

brazen copper
#

The timer is not confusing, it just executes an event after 0.1 seconds, the confusing thing is the other thing

stoic hamlet
#

oh so the timer just executes the event to remove and add those groups after 0.1s okay

#

so what am i confused about then?

brazen copper
#

Since you can't run both groups at the same time you need the first group to run first and then the second group to run, in this case with a delay of 0.1 seconds.

stoic hamlet
#

so its not running twice?

#

or does the event the timer calls upon happen before the "spawn_Sticks" right under it?

brazen copper
#

yes, the timeline would be like this,
player hits entity > executes event "spawn_ricky:dirt_man" > adds component group "spawn_dirt_man" > 0.1 seconds > executes event "spawn_ricky:stick" > removes previous component group and adds component group "spawn_Stick"

stoic hamlet
#

ahh okay

#

intresting

#

ima play w that a little thanks

brazen copper
#

yes although I have seen that you use the loot_tables, a shorter way would have been to use the /loot command to summon the sticks

stoic hamlet
#

you mean the drops when it dies?

#

i havent set those up yet but i dont want it to be sticks its gunna be other custom stuff, but i didnt think of that

brazen copper
#

No, I mean the same operation but using /loot

#

I think it gave you more freedom

#

and the code would be less complicated

stoic hamlet
#

the loot_tables is the folder that you put the drops file in "lootx.json"

stoic hamlet
brazen copper
stoic hamlet
#

is this what your refering to?

#

thats the wrong one oops

brazen copper
#

"spawn_ricky:dirt_man": {
"add": {
"component_groups": [
"spawn_dirt_man"
]
},
"queue_command": {
"command": "loot spawn ~ ~ ~ loot "lot_tables/sticks""
}
},

stoic hamlet
stoic hamlet
#

oh just to collect the loot table for it in game

#

without it dying

brazen copper
#

yes

stoic hamlet
#

true but would it not loot all of the table not just the sticks?

#

and id have to specify the amount of sticks so itd drop the same amount when it does die

brazen copper
#

? No

#

This is just a /loot spawn, it does not affect the entity's default loot.

stoic hamlet
brazen copper
#

just set up a new loot_table

stoic hamlet
#

this doesnt have one yet

stoic hamlet
#

i changed the timer aswell to 0.2 same thing

#

i didnt change anything either lmfao

brazen copper
#

change looping: true

stoic hamlet
#

okay

#

it works occasionally

#

its not a guarenteed thing

#

i hit it like 8 times and it did spawn more of them but alot more sticks

stoic hamlet
brazen copper
#

I see, are you hitting too fast?

stoic hamlet
#

no if i hit it once it doesnt spawn them

#

just sticks

#

i hit them 3 or 4 times slow then the rest back to back and it spawned

#

1 sec

brazen copper
#

show me the code

stoic hamlet
brazen copper
#

"max_wait_time": 0

stoic hamlet
#

genuis

#

oh does that max weight time mean that the game can make it wait longer than what our timer was doing?

#

so that by the time it tried to activate we didnt have the right group names to spawn the entities

brazen copper
#

yes

stoic hamlet
#

ah okay i didnt think about that

#

do you think its possible to make an event that takes an item from the players inventory ?

#

such as dirt 1 would be taken out of the inventory

#

on damage

brazen copper
#

you mean, if i hit dirtman do i lose a block of dirt?

stoic hamlet
#

yeah

#

like if i hit dirtman with a dirt block in my hand

#

itll take 1 dirt from my hand

#

i know thats possible with functions and scripts but if that can be avoided thats amazing

brazen copper
#

It would be the same case as using the dirt_wand

stoic hamlet
#

yeah i figured that much its the removing from inventory im wondering about

#

is that even possible using the entity file?

brazen copper
#

yes of course you would just have to add it, what is supposed to happen after using the earth block? Should it cause damage?

stoic hamlet
#

itd be player hits dirtman with dirt block> 1 dirt removed from hand>1 grass block spawned

brazen copper
#

wtf what do you mean grass block? the dirtman disappears?

stoic hamlet
#

no

#

spawn_item

brazen copper
#

ah

stoic hamlet
#

lmao dirtman is safe dw

brazen copper
stoic hamlet
#

"clear @s grass_block 0 1"

#

how does this work?

#

clear self grass_block 0 1

#

should that not be dirt?

#

since its needing to remove 1 dirt from the inventory and dropping 1 grass block on the ground

#

ik the grass_block group is also what spawns it tho so im unsure

#

well nvm its spawn_grassblock

#

still unsure

brazen copper
#

oh my bad just change it

stoic hamlet
#

okay

#

what does the 0 and the 1 do?

#

is that min and max?

brazen copper
#

data and amount

stoic hamlet
#

ahh

#

what does data refer to?

brazen copper
#

although I always forget the order

#

For example when you refer to stone, andesite, and other stone type blocks, they have the same id minecraft:stone, they only vary in the data

stoic hamlet
#

ah so data would be something super specific

#

that works so easy whatt

brazen copper
#

for example when you say give @s light_block, the light_block has 16 lighting levels, and you can get any of these 16 levels by changing the data

stoic hamlet
#

oh okay

#

thats pretty neat

#

its 4 am now so i gotta head to bed but thanks for the help ill do some more tomorow

#

the dirt-> grass worked btw

brazen copper
#

Although I don't remember if it was data/amount or amount/data I always forget

stoic hamlet
#

it was data amount

brazen copper
#

👍

stoic hamlet
# brazen copper 👍

do you happen to know how to add equiped armor to an entity using the loot_table? i saw here that it can be done but theres nothing helpful about the loo ttable file in documentation

#

Random Help questions

#

"minecraft:equipment": {
"table": "loot_tables/entities/pillager_captain_equipment.json",
"slot_drop_chance": [
{
"slot": "slot.armor.chest",
"drop_chance": 1.0
}
]
}

#

thats the example they give

brazen copper
#

you just have to check the minecraft files

stoic hamlet
#

thanks though i looked up more and am messin with it but i cant seem to figure out drop chances, my item dirt wand refuses to drop even tho ive set it up the same as my other entities

brazen copper
stoic hamlet
#

it drops, but i was wondering if theres a way to specify the chance it drops?

#

i assumed it would be weight but having that as 100 still doesnt drop each time , and 50 doesnt drop half the time

brazen copper
#

If you only have one item it should drop no matter how much weight it has.

#

Ah, I understand now. In that case, you can leave an empty space with a weight of 90 and the wand with a weight of 10, for example.

stoic hamlet
#

ah so it would be a 90 weight that the empty drops and 10 that the wand drops

#

thats smart

brazen copper
#

{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "item",
"name": "stick",
"weight": 10
},
{
"weight": 90
}
]
}
]
}

#

If that doesn't work you could try this
{
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "item",
"name": "stick",
"weight": 10
},
{
"type": "item",
"name": "air",
"weight": 90
}
]
}
]
}

stoic hamlet
#

{
"weight": 80,
"type":"empty"
}

#

does empty type work?

brazen copper
#

Yes I guess that works too

#

It is an accepted option although I think I never used it but it should serve for these cases

stoic hamlet
#

i dont th8ink its affecting the drop rates for the better but its worth a few tests

#

in my equipment file is there a way to guarentee they spawn btw?

#

i thought they were already guarenteed to but occasionally they dont

brazen copper
#

show me

stoic hamlet
#

i changed the random dificulty chance but those are unimportant atm

#

probably gunna remove those random difficulty conditions aswell since i dont think ima be using that for anything

brazen copper
#

That is random equipment generation, do you need your entity to always have diamond equipment?

stoic hamlet
#

im just wanting to learn how to do it for when i need to

stoic hamlet
#

and ah i didnt know that was random gen

#

i thought it was random enchant but didnt know gen too

brazen copper
#

Basically it would be like this, then you add the functions you need

stoic hamlet
#

oh all in one pool?

#

so the pools are what run differently in loot tables

#

okay

brazen copper
brazen copper
stoic hamlet
stoic hamlet
brazen copper
stoic hamlet
#

in the old file each armor piece had its own "pools": but in the always spawning one its all in one pool

brazen copper
#

I see, I don't understand how pools inside other pools work, for some reason it works but it doesn't make much sense to me, and the documentation doesn't say anything about pools inside other pools.

stoic hamlet
#

hm okay def intresting

#

ive been messing with the lootx drops and the dirt wand drop chance went up a good bit but it only ever spawns those when i have another item with a chance to spawn aswell

#

{
"pools": [
{
"rolls": 1,
"entries": [
{
"weight": 100,
"type": "item",
"name": "ricky:dirt_wand",
"functions": [
{
"function": "set_count",
"count": {
"min": 1,
"max": 1
}

          },
          {
            "function": "specific_enchants",
            "enchants":[
                {
                    "id": "sharpness",
                    "level": 1
                },
                {
                    "id": "efficiency",
                    "level": 2
                }
            ]
          }
          
          
          
        ]
      },
      {
        "weight": 100,
        "type":"item",
        "name": "minecraft:dirt",
        "functions": [{
            "function": "set_count",
            "count":{
                "min":1,
                "max":5
            }
      }]
      }
      
     
    ]
  }
]

}

#

do you see anythjing that could be an issue? i get no errors just no dirt either

brazen copper
#

In this case it seems that you have randomized the loot

#

50/50

stoic hamlet
#

oh?

#

is it the 100 100 weight or did i put it in the wrong spot

#

seems to only work with the wand i changed the weight

brazen copper
#

mmm no, the weight is related to the weight of the other, if you put 1-1 2-2 100-100 it means that they have equal chances of appearing, that is, 50/50

stoic hamlet
#

is there a way to fix that in the lootx to have guarenteed drops?