use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class BlockDemonCrystal method breakBlock.
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state) {
TileEntity tile = world.getTileEntity(pos);
if (tile instanceof TileDemonCrystal) {
EnumDemonWillType type = state.getValue(TYPE);
int number = ((TileDemonCrystal) tile).getCrystalCount();
spawnAsEntity(world, pos, getItemStackDropped(type, number));
world.removeTileEntity(pos);
}
super.breakBlock(world, pos, state);
}
use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class ItemSentientArmour method onPlayerAttacked.
public void onPlayerAttacked(ItemStack stack, DamageSource source, EntityPlayer attackedPlayer) {
if (source.getTrueSource() instanceof EntityLivingBase) {
EntityLivingBase attacker = (EntityLivingBase) source.getTrueSource();
EnumDemonWillType type = this.getCurrentType(stack);
switch(type) {
case CORROSIVE:
if (!source.isProjectile()) {
// TODO: customize duration
attacker.addPotionEffect(new PotionEffect(MobEffects.POISON, 100));
}
break;
case DEFAULT:
break;
case DESTRUCTIVE:
break;
case STEADFAST:
break;
case VENGEFUL:
break;
}
}
}
use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class ItemSentientArmour method damageArmor.
@Override
public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) {
if (entity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) entity;
EnumDemonWillType type = getCurrentType(stack);
double willRequired = this.getCostModifier(stack) * damage;
double willLeft = PlayerDemonWillHandler.getTotalDemonWill(type, player);
if (willLeft >= willRequired && canSustainArmour(type, willLeft)) {
this.setAbilitiesOfArmour(type, willLeft - willRequired, stack);
PlayerDemonWillHandler.consumeDemonWill(type, player, willRequired);
} else {
this.revertArmour(player, stack);
}
}
}
use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class ItemSentientArmour method gatherVariants.
@Override
public void gatherVariants(Consumer<String> variants) {
for (EnumDemonWillType type : EnumDemonWillType.values()) {
String additional = "_" + type.getName().toLowerCase();
variants.accept("armour=head" + additional);
variants.accept("armour=body" + additional);
variants.accept("armour=leg" + additional);
variants.accept("armour=feet" + additional);
}
}
use of WayofTime.bloodmagic.soul.EnumDemonWillType in project BloodMagic by WayofTime.
the class ItemSentientArmourGem method onItemRightClick.
@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
boolean hasSentientArmour = false;
NonNullList<ItemStack> armourInventory = player.inventory.armorInventory;
for (ItemStack armourStack : armourInventory) {
if (armourStack != null && armourStack.getItem() instanceof ItemSentientArmour) {
hasSentientArmour = true;
}
}
if (hasSentientArmour) {
ItemSentientArmour.revertAllArmour(player);
} else {
EnumDemonWillType type = PlayerDemonWillHandler.getLargestWillType(player);
double will = PlayerDemonWillHandler.getTotalDemonWill(type, player);
// PlayerDemonWillHandler.consumeDemonWill(player, willBracket[bracket]);
ItemSentientArmour.convertPlayerArmour(type, will, player);
}
return new ActionResult<>(EnumActionResult.PASS, player.getHeldItem(hand));
}
Aggregations