All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.magistuarmory.util.MobEquipmentHelper Maven / Gradle / Ivy

The newest version!
package com.magistuarmory.util;

import com.magistuarmory.EpicKnights;
import net.minecraft.class_1267;
import net.minecraft.class_1304;
import net.minecraft.class_1309;
import net.minecraft.class_1792;
import net.minecraft.class_1799;
import net.minecraft.class_1802;
import net.minecraft.class_5819;
import net.minecraft.world.item.*;

import java.util.List;

public class MobEquipmentHelper
{
    public static void equip(class_1309 entity)
    {
        if (!entity.field_6002.method_8608() && EpicKnights.GENERAL_CONFIG.equipMonsters && (!EpicKnights.GENERAL_CONFIG.equipMonstersOnlyIfHard || entity.field_6002.method_8407().equals(class_1267.field_5807)))
        {
            class_5819 rand = entity.field_6002.method_8409();
            List equipments = MobEquipment.get(entity);
            if (equipments.size() > 0)
                equipments.get(rand.method_43048(equipments.size())).equip(entity, rand);
        }
    }

    static void setRandomItemSlot(class_1309 entity, class_1304 slot, List items, double chance, class_5819 rand)
    {
        if (items.size() == 0)
        {
            if (EpicKnights.GENERAL_CONFIG.overrideEquipment)
                entity.method_5673(slot, new class_1799(class_1802.field_8162));
            return;
        }

        int id = rand.method_43048((int) (items.size() / chance));

        if (id < items.size())
            entity.method_5673(slot, new class_1799(items.get(id)));
        
        else if (EpicKnights.GENERAL_CONFIG.overrideEquipment)
            entity.method_5673(slot, new class_1799(class_1802.field_8162));
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy