use of WayofTime.bloodmagic.soul.IDemonWill in project BloodMagic by WayofTime.
the class ItemSentientPickaxe 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;
}
use of WayofTime.bloodmagic.soul.IDemonWill in project BloodMagic by WayofTime.
the class ItemSoulGem method fillDemonWillGem.
@Override
public ItemStack fillDemonWillGem(ItemStack soulGemStack, ItemStack soulStack) {
if (soulStack != null && soulStack.getItem() instanceof IDemonWill) {
EnumDemonWillType thisType = this.getCurrentType(soulGemStack);
if (thisType != ((IDemonWill) soulStack.getItem()).getType(soulStack)) {
return soulStack;
}
IDemonWill soul = (IDemonWill) soulStack.getItem();
double soulsLeft = getWill(thisType, soulGemStack);
if (soulsLeft < getMaxWill(thisType, soulGemStack)) {
double newSoulsLeft = Math.min(soulsLeft + soul.getWill(thisType, soulStack), getMaxWill(thisType, soulGemStack));
soul.drainWill(thisType, soulStack, newSoulsLeft - soulsLeft);
setWill(thisType, soulGemStack, newSoulsLeft);
if (soul.getWill(thisType, soulStack) <= 0) {
return ItemStack.EMPTY;
}
}
}
return soulStack;
}
use of WayofTime.bloodmagic.soul.IDemonWill in project BloodMagic by WayofTime.
the class TileSoulForge method consumeSouls.
public double consumeSouls(EnumDemonWillType type, double requested) {
ItemStack soulStack = getStackInSlot(soulSlot);
if (soulStack != null) {
if (soulStack.getItem() instanceof IDemonWill && ((IDemonWill) soulStack.getItem()).getType(soulStack) == type) {
IDemonWill soul = (IDemonWill) soulStack.getItem();
double souls = soul.drainWill(type, soulStack, requested);
if (soul.getWill(type, soulStack) <= 0) {
setInventorySlotContents(soulSlot, ItemStack.EMPTY);
}
return souls;
}
if (soulStack.getItem() instanceof IDemonWillGem) {
IDemonWillGem soul = (IDemonWillGem) soulStack.getItem();
return soul.drainWill(type, soulStack, requested, true);
}
}
return 0;
}
use of WayofTime.bloodmagic.soul.IDemonWill in project BloodMagic by WayofTime.
the class ItemSentientAxe 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;
}
use of WayofTime.bloodmagic.soul.IDemonWill in project BloodMagic by WayofTime.
the class ItemSentientSword 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