entity.attack(player,10)```
```[10:13:53] [ERROR] ! equipment.js#81: Error in 'ServerEvents.tick': Can't find method net.minecraft.world.entity.monster.Zombie.m_6469_(net.minecraft.server.level.ServerPlayer,number).
[10:13:53] [ERROR] ! …rhino.EvaluatorException: Can't find method net.minecraft.world.entity.monster.Zombie.m_6469_(net.minecraft.server.level.ServerPlayer,number). (server_scripts:equipment.js#81)```I want to damage the entity so the player gets the kill, because I am making a wand system right now. In 1.19.2 I was able to just use player, but now it doesn't work anymore
#Using player as damage source
41 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
entity.attack('player',10)
But then it doesn't know what player
that's kinda complex i think? maybe someone skilled can help
Would it be the player's entity ID?
(also I cannot contribute much to this conversation past this passing comment)
Either - is the attack function a KJS implementation, or native MC?
console log this when you punch somethingjs EntityEvents.hurt(event => { console.log(event.source.getType()) })
Just [15:47:07] [INFO] equipment.js#108: player

i mean i assume if its a player damage source it will automatically get the last damage source and display the message of "this player killed this"
maybe test 'player' out like rad suggested
and see if you get the player name in the death message
I mean a normal mob doesn't have a death message
[15:49:33] [ERROR] ! equipment.js#89: Error in 'ServerEvents.tick': Can't find method net.minecraft.world.entity.monster.Zombie.m_6469_(string,number).```

I always autopilote and format it as js
Well, so it doesn't like the method signature of (string, number) so that's cool
I mean its (Internal.DamageType,number)
try this js function getDamageSource(/** @type {Internal.Level}*/ level, /** @type {Internal.DamageType_}*/ damageType) { const resourceKey = $ResourceKey.create(DAMAGE_TYPE, Utils.id(damageType)) const holder = level.registryAccess().registryOrThrow(DAMAGE_TYPE).getHolderOrThrow(resourceKey) return new DamageSource(holder) } const $ResourceKey = Java.loadClass("net.minecraft.resources.ResourceKey") const DAMAGE_TYPE = $ResourceKey.createRegistryKey("damage_type") ItemEvents.rightClicked(event => { const {player} = event // Create damage source const damageSource = getDamageSource(player.getLevel(), "player"); entity.attack(damageSource, 10) })
pulled from the 1.20 radiation script and dumbed down
i assume you dont need the lang file if we're using 'player' here
[15:54:47] [ERROR] ! equipment.js#96: Error in 'ServerEvents.tick': TypeError: Cannot call property level in object ServerPlayer['Dragonlord14545'/101, l='ServerLevel[Building world]', x=-20.44, y=0.66, z=-13.99]. It is not a function, it is "object".```
do getLevel()
not sure why it works in the radiation script like that tbh 
edited above
[15:56:01] [ERROR] ! Error in 'ServerEvents.tick': Missing key in ResourceKey[minecraft:root / minecraft:damage_type]: ResourceKey[minecraft:damage_type / minecraft:player]
[15:56:01] [ERROR] ! java.lang.IllegalStateException: Missing key in ResourceKey[minecraft:root / minecraft:damage_type]: ResourceKey[minecraft:damage_type / minecraft:player]```
sec
try this one js ItemEvents.rightClicked(event => { const { player, entity } = event const newdamagesource = entity.damageSources().playerAttack(player) entity.attack(newdamagesource, 10) })
??closeticket
Please close your ticket (with </ticket close:1054771505520717835> or the button atop this thread) once you resolved your issue! This also helps others that would like to help out, as they don't have to look into this thread to check if it has been resolved by now.
Do you have any other questions regarding your issue? Feel free to ask!
Note: You should generally create a new post for unrelated issues.
I am not that fast at typing