Search in sources :

Example 6 with IDemonWill

use of WayofTime.bloodmagic.soul.IDemonWill in project BloodMagic by WayofTime.

the class ContainerSoulForge method transferStackInSlot.

@Override
public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) {
    ItemStack itemstack = ItemStack.EMPTY;
    Slot slot = this.inventorySlots.get(index);
    if (slot != null && slot.getHasStack()) {
        ItemStack itemstack1 = slot.getStack();
        itemstack = itemstack1.copy();
        if (index == 5) {
            if (!this.mergeItemStack(itemstack1, 6, 6 + 36, true)) {
                return ItemStack.EMPTY;
            }
            slot.onSlotChange(itemstack1, itemstack);
        } else if (index > 5) {
            if (itemstack1.getItem() instanceof IDemonWill || itemstack1.getItem() instanceof IDemonWillGem) {
                if (!this.mergeItemStack(itemstack1, 4, 5, false)) {
                    return ItemStack.EMPTY;
                }
            } else if (!this.mergeItemStack(itemstack1, 0, 4, false)) {
                return ItemStack.EMPTY;
            }
        } else if (!this.mergeItemStack(itemstack1, 6, 42, false)) {
            return ItemStack.EMPTY;
        }
        if (itemstack1.getCount() == 0) {
            slot.putStack(ItemStack.EMPTY);
        } else {
            slot.onSlotChanged();
        }
        if (itemstack1.getCount() == itemstack.getCount()) {
            return ItemStack.EMPTY;
        }
        slot.onTake(playerIn, itemstack1);
    }
    return itemstack;
}
Also used : IDemonWillGem(WayofTime.bloodmagic.soul.IDemonWillGem) Slot(net.minecraft.inventory.Slot) IDemonWill(WayofTime.bloodmagic.soul.IDemonWill) ItemStack(net.minecraft.item.ItemStack)

Example 7 with IDemonWill

use of WayofTime.bloodmagic.soul.IDemonWill in project BloodMagic by WayofTime.

the class ItemSentientShovel method getRandomDemonWillDrop.

@Override
public List<ItemStack> getRandomDemonWillDrop(EntityLivingBase killedEntity, EntityLivingBase attackingEntity, ItemStack stack, int looting) {
    List<ItemStack> soulList = new ArrayList<>();
    if (killedEntity.getEntityWorld().getDifficulty() != EnumDifficulty.PEACEFUL && !(killedEntity instanceof IMob)) {
        return soulList;
    }
    double willModifier = killedEntity instanceof EntitySlime ? 0.67 : 1;
    IDemonWill soul = ((IDemonWill) RegistrarBloodMagicItems.MONSTER_SOUL);
    EnumDemonWillType type = this.getCurrentType(stack);
    for (int i = 0; i <= looting; i++) {
        if (i == 0 || attackingEntity.getEntityWorld().rand.nextDouble() < 0.4) {
            ItemStack soulStack = soul.createWill(type.ordinal(), willModifier * (this.getDropOfActivatedSword(stack) * attackingEntity.getEntityWorld().rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)) * killedEntity.getMaxHealth() / 20d);
            soulList.add(soulStack);
        }
    }
    return soulList;
}
Also used : IMob(net.minecraft.entity.monster.IMob) EntitySlime(net.minecraft.entity.monster.EntitySlime) IDemonWill(WayofTime.bloodmagic.soul.IDemonWill) ItemStack(net.minecraft.item.ItemStack) EnumDemonWillType(WayofTime.bloodmagic.soul.EnumDemonWillType)

Aggregations

IDemonWill (WayofTime.bloodmagic.soul.IDemonWill)7 ItemStack (net.minecraft.item.ItemStack)6 EnumDemonWillType (WayofTime.bloodmagic.soul.EnumDemonWillType)5 EntitySlime (net.minecraft.entity.monster.EntitySlime)4 IMob (net.minecraft.entity.monster.IMob)4 IDemonWillGem (WayofTime.bloodmagic.soul.IDemonWillGem)2 Slot (net.minecraft.inventory.Slot)1