#weird crash

21 messages · Page 1 of 1 (latest)

acoustic brook
#

trying to make a script that empties an entities hand and summons an item entity that flys towards the player, but for some reason I just crash everytime it runs. any help would be amazing

StartupEvents.registry('palladium:abilities', (EventHandler) => {
    EventHandler
        .create('gravestone:magnetic_disarm')
        .icon(palladium.createItemIcon('minecraft:blaze_rod'))
        .documentationDescription('Disarming ability, nuff said - VenWhoVian')
        .firstTick((entity, enabled) => {
            if (enabled) {
                let targets = entity.level.getEntities(entity, AABB.ofSize(entity.position(), 10, 10, 10)).toArray();

                targets.forEach(otherEntity => {
                    if (otherEntity.mainHandItem && otherEntity.mainHandItem.id) { // Added null and id check
                        let item = otherEntity.block.createEntity("minecraft:item");
                        item.mergeNbt({
                            Item: { id: otherEntity.mainHandItem.id, Count: 1 },
                            PickupDelay: 20
                        });
                        item.setPosition(otherEntity.x, otherEntity.y, otherEntity.z);
                        otherEntity.mainHandItem = "minecraft:air";

                        let direction = entity.position().subtract(item.position()).normalize();
                        item.setDeltaMovement(direction.x * 0.5, direction.y * 0.5, direction.z * 0.5);
                    }
                });
            }
        });
});
silver ermineBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

acoustic brook
subtle lintelBOT
#

Paste version of crash-2025-04-13_18.54.17-server.txt from @acoustic brook

severe thunder
# acoustic brook

In what condition did the game crash? Did it crashed when game launched? or upon joining a new world, or upon entities come close to you?

acoustic brook
severe thunder
acoustic brook
#

No

severe thunder
#

Sounds like it's triggered by entity coming close to you

#

Does the ability keeps working every tick? I know little about palladium.

acoustic brook
#

It’s only for one tick

#

The palladium bit doesn’t change very much, it just gives me a few extra functions to mess with

severe thunder
#

would that be because of specific weird item? I've seen broken item in player's item causing ticking player crashes

acoustic brook
#

The item it was trying to move was a warped mushroom

#

I think it may have been because of the way I grabbed the ID? But I can’t see anything wrong with the way I did that

severe thunder
#

Maybe we can comment out the part of item manipulation to check if the issue is in targets part or item part

severe thunder
#

oh, maybe it's because an empty mainHanditem can return "minecraft:air", which has id and is not null?

acoustic brook
#

Ahhh

#

Didn’t think of that

#

Lemme make some minor modifications rq to not grab “air”

acoustic brook
#

yeah no its still crashing