#Prevent certain mobs from picking up items/blocks

7 messages · Page 1 of 1 (latest)

prime swift
#

I have created the following script in an attempt to prevent certain mobs from picking up items/blocks after looking through the discord server and google for similar goals:

    let entity = event.entity;
    if (entity.type == 'minecraft:zombie' || entity.type == 'minecraft:skeleton' || entity.type == 'minecraft:enderman'){
        console.log("value changed")
    entity.setCanPickUpLoot(false)}
    else {
    console.log("value unchanged")}
});```
I can see my logs working correctly, but Endermen can still pick up blocks and I can't figure out a way to test is the nbt value is being applied to any of the entities. I would appreciate some insight on this, thanks!
untold flameBOT
#

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

prime swift
#

Is there a separate rule I need to use to prevent the block picking up? And is there a good way to test is spawned mobs are having that modifier applied correctly?

warped thistle
#

endermen picking up nearby blocks is a goal, not an nbt field, you can remove it with EntityJs goal event js const EndermanTakeBlockGoal = Java.loadClass("net.minecraft.world.entity.monster.EnderMan$EndermanTakeBlockGoal") EntityJSEvents.addGoalSelectors("minecraft:enderman", event => { event.removeGoal(EndermanTakeBlockGoal) })

prime swift
warped thistle
#

for those you should stick to what you have, the enderman take goal and the zombies picking up armor are 2 entirely seperate things

prime swift
#

works! thanks so much for your help