package net.minecraft.world.entity.monster.piglin;

import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.item.Items;
import net.minecraft.server.level.ServerLevel;
import java.util.Map;
import com.google.common.collect.ImmutableMap;
import net.minecraft.world.entity.ai.memory.MemoryStatus;
import net.minecraft.world.entity.ai.memory.MemoryModuleType;
import net.minecraft.world.entity.ai.behavior.Behavior;

public class StopHoldingItemIfNoLongerAdmiring<E extends Piglin> extends Behavior<E> {
    public StopHoldingItemIfNoLongerAdmiring() {
        super(ImmutableMap.<MemoryModuleType<Boolean>, MemoryStatus>of(MemoryModuleType.ADMIRING_ITEM, MemoryStatus.VALUE_ABSENT));
    }
    
    @Override
    protected boolean checkExtraStartConditions(final ServerLevel zd, final E bdc) {
        return !bdc.getOffhandItem().isEmpty() && bdc.getOffhandItem().getItem() != Items.SHIELD;
    }
    
    @Override
    protected void start(final ServerLevel zd, final E bdc, final long long3) {
        PiglinAi.stopHoldingOffHandItem(bdc, true);
    }
}
