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;
}
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;
}
Aggregations