#how to use EntityEvents.hurt and healing entity after?
21 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
so what do u want to do? more context
there is an entity melting in a tinkers smeltery, i cant set the damage to 0 or else it wont work, but i dont want the entity to die
event.custom({
"type": "tconstruct:entity_melting",
"entity": {
"types": [
'create_confectionery:little_gingerbread_man'
]
},
"result": {
"fluid": "kubejs:essence_of_whimsy",
"amount": 40
},
"damage": 1
})
for context of code for melting
@wind turret
EntityEvents.hurt(e=> {
console.log(e.damage)
if ((e.source.getType() == "tconstruct.smeltery_magic" || e.source.getType() == "tconstruct.smeltery_heat") && !e.entity.player) {
e.entity.heal(e.getDamage())
}
})
oh?
this works for all entity, except player
yeah, hold on
here
const entity_list = ["minecraft:blaze", "minecraft:polar_bear"]
EntityEvents.hurt(e=> {
if (entity_list.includes(e.entity.type)) {
if (e.source.getType() == "tconstruct.smeltery_magic" || e.source.getType() == "tconstruct.smeltery_heat") {
e.entity.heal(e.getDamage())
}
}
})
thank you so much! :D
i shall test to see if it works
it works flawlessly! holy
thank you again!
Ticket closed!
have a nice day