IItemInteractionForEntity

Link to iiteminteractionforentity

The IItemInteractionForEntity function can be added to an Item and will be triggered when a player right clicks on an entity with the item.

패키지 임포트하기

Link to 패키지-임포트하기

It might be required for you to import the package if you encounter any issues, so better be safe than sorry and add the import.
import mods.contenttweaker.IItemInteractionForEntity;

The IItemInteractionForEntity function is a function with the following parameters:

The function needs to return either true or false

ZenScript
Copy
#loader contenttweaker

import mods.contenttweaker.VanillaFactory;
import mods.contenttweaker.Item;
import mods.contenttweaker.IItemInteractionForEntity;
import crafttweaker.entity.IEntityLivingBase;

var sheep_remover = VanillaFactory.createItem("sheep_remover");
sheep_remover.itemInteractionForEntity = function(stack, player, target, hand) {
    if target.definition.id == "minecraft:sheep" {
        target.removeFromWorld();
        stack.shrink(1);
        return true;
    }
    return false;
};
sheep_remover.register();