#how do I detect the item in an entities main hand?
19 messages · Page 1 of 1 (latest)
Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!
It's normally just entity.mainHand
...is it really that simple
sigh yeah that tracks for me
I mean it doesn't crash when I run the script anymore but it still isn't detecting items
weird
might be an issue with the detection not the other part tho, so Ig that answers my question
Ticket closed!
i had a VERY similar problem. the thing is, entity.MainHand is not an Item.of((string here)) value, from what i can see
let me see if i can find my fix rq
event.getEntity().getMainHandItem()
i took this from a BlockEvent.broken script. you have to explicitly request the item itself, not the slot.
I'm messing with this idea myself, but whenever I try and run the script, I just crash, could you enlighten me a bit?(I'm VERY new to KubeJS, so if it's something dumb I'm sorry 😭)
let eyePos = player.eyePosition;
let aabb = AABB.of(eyePos.x(), eyePos.y(), eyePos.z(), endPos.x(), endPos.y(), endPos.z());
let searchArea = aabb.of(
player.x - 7, player.y - 7, player.z - 7,
player.x + 7, player.y + 7, player.z + 7
);
let nearbyEntities = player.level.getEntities(searchArea, entity => entity !== player);
nearbyEntities.forEach(otherEntity => {
player.tell(`Entity: ${otherEntity.getType().getId()}, Position: ${otherEntity.position()}`);
});
Please send your KubeJS server log. It can be found at /minecraft/logs/kubejs/server.log.
If you are on 1.18 or 1.16 it will be called server.txt.
Please send the file directly, without links or snippets.
i have no idea regarding searching a volume for entities, but i can send you my scripts, which you can use as reference
note: item_application features mod detection. in this case, create
Paste version of chiseling.js, item_application.js from @fallow bridge