Decreased effect of looting for the Sentient Sword. Allowed the sword to attack when deactivated. Allowed blocking with the sword.

This commit is contained in:
WayofTime 2016-01-29 21:08:30 -05:00
parent e0fcf10a1b
commit 219b997b24

View file

@ -47,7 +47,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{ {
if (player.isSneaking()) //TODO: change its state depending on soul consumption if (player.isSneaking())
setActivated(stack, !getActivated(stack)); setActivated(stack, !getActivated(stack));
if (getActivated(stack)) if (getActivated(stack))
@ -64,6 +64,7 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon
setDropOfActivatedSword(stack, level >= 0 ? soulDrop[level] : 0); setDropOfActivatedSword(stack, level >= 0 ? soulDrop[level] : 0);
} }
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
return stack; return stack;
} }
@ -121,11 +122,9 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon
PlayerDemonWillHandler.consumeDemonWill(player, drain); PlayerDemonWillHandler.consumeDemonWill(player, drain);
} }
} }
return super.onLeftClickEntity(stack, player, entity);
} }
return true; return super.onLeftClickEntity(stack, player, entity);
} }
public boolean getActivated(ItemStack stack) public boolean getActivated(ItemStack stack)
@ -155,11 +154,14 @@ public class ItemSentientSword extends ItemSword implements IDemonWillWeapon
IDemonWill soul = ((IDemonWill) ModItems.monsterSoul); IDemonWill soul = ((IDemonWill) ModItems.monsterSoul);
for (int i = 0; i <= looting; i++) for (int i = 0; i <= looting; i++)
{
if (i == 0 || attackingEntity.worldObj.rand.nextDouble() < 0.3)
{ {
ItemStack soulStack = soul.createWill(0, this.getDropOfActivatedSword(stack) * attackingEntity.worldObj.rand.nextDouble() + this.getStaticDropOfActivatedSword(stack)); ItemStack soulStack = soul.createWill(0, this.getDropOfActivatedSword(stack) * attackingEntity.worldObj.rand.nextDouble() + this.getStaticDropOfActivatedSword(stack));
soulList.add(soulStack); soulList.add(soulStack);
} }
} }
}
return soulList; return soulList;
} }