use of WayofTime.bloodmagic.item.armour.ItemSentientArmour 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));
}
use of WayofTime.bloodmagic.item.armour.ItemSentientArmour in project BloodMagic by WayofTime.
the class StatTrackerHandler method entityHurt.
// Tracks: Fall Protect, Arrow Protect, Physical Protect, Grave Digger, Sprint Attack, Critical Strike, Nocturnal Prowess
@SubscribeEvent
public static void entityHurt(LivingHurtEvent event) {
DamageSource source = event.getSource();
Entity sourceEntity = event.getSource().getTrueSource();
EntityLivingBase attackedEntity = event.getEntityLiving();
if (attackedEntity instanceof EntityPlayer) {
EntityPlayer attackedPlayer = (EntityPlayer) attackedEntity;
// Living Armor Handling
if (LivingArmour.hasFullSet(attackedPlayer)) {
float amount = Math.min(Utils.getModifiedDamage(attackedPlayer, event.getSource(), event.getAmount()), attackedPlayer.getHealth());
ItemStack chestStack = attackedPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) {
if (sourceEntity != null && !source.isMagicDamage() && !source.isProjectile())
StatTrackerPhysicalProtect.incrementCounter(armour, amount);
if (source.equals(DamageSource.FALL))
StatTrackerFallProtect.incrementCounter(armour, amount);
if (source.isProjectile())
StatTrackerArrowProtect.incrementCounter(armour, amount);
}
} else {
ItemStack chestStack = attackedPlayer.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
if (chestStack.getItem() instanceof ItemSentientArmour) {
ItemSentientArmour armour = (ItemSentientArmour) chestStack.getItem();
armour.onPlayerAttacked(chestStack, source, attackedPlayer);
}
}
}
if (sourceEntity instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) sourceEntity;
// Living Armor Handling
if (LivingArmour.hasFullSet(player)) {
ItemStack chestStack = player.getItemStackFromSlot(EntityEquipmentSlot.CHEST);
LivingArmour armour = ItemLivingArmour.getLivingArmour(chestStack);
if (armour != null) {
ItemStack mainWeapon = player.getItemStackFromSlot(EntityEquipmentSlot.MAINHAND);
event.setAmount((float) (event.getAmount() + lastPlayerSwingStrength * armour.getAdditionalDamageOnHit(event.getAmount(), player, attackedEntity, mainWeapon)));
float amount = Math.min(Utils.getModifiedDamage(attackedEntity, event.getSource(), event.getAmount()), attackedEntity.getHealth());
if (!source.isProjectile()) {
StatTrackerMeleeDamage.incrementCounter(armour, amount);
if (player.getEntityWorld().getLight(player.getPosition()) <= 9)
StatTrackerNightSight.incrementCounter(armour, amount);
if (mainWeapon.getItem() instanceof ItemSpade)
StatTrackerGraveDigger.incrementCounter(armour, amount);
if (player.isSprinting())
StatTrackerSprintAttack.incrementCounter(armour, amount);
boolean isCritical = lastPlayerSwingStrength > 0.9 && player.fallDistance > 0.0F && !player.onGround && !player.isOnLadder() && !player.isInWater() && !player.isPotionActive(MobEffects.BLINDNESS) && !player.isRiding() && !player.isSprinting();
if (isCritical)
StatTrackerCriticalStrike.incrementCounter(armour, amount);
double kb = armour.getKnockbackOnHit(player, attackedEntity, mainWeapon);
if (kb > 0)
attackedEntity.knockBack(player, (float) kb * 0.5F, (double) MathHelper.sin(player.rotationYaw * 0.017453292F), (double) (-MathHelper.cos(player.rotationYaw * 0.017453292F)));
}
}
}
}
}
use of WayofTime.bloodmagic.item.armour.ItemSentientArmour in project BloodMagic by WayofTime.
the class RegistrarBloodMagicItems method registerItems.
@SubscribeEvent
public static void registerItems(RegistryEvent.Register<Item> event) {
items = Lists.newArrayList();
RegistrarBloodMagicBlocks.blocks.stream().filter(block -> block instanceof IBMBlock && ((IBMBlock) block).getItem() != null).forEach(block -> {
IBMBlock bmBlock = (IBMBlock) block;
items.add(bmBlock.getItem().setRegistryName(block.getRegistryName()));
});
items.addAll(Lists.newArrayList(new ItemBloodOrb().setRegistryName("blood_orb"), new ItemActivationCrystal().setRegistryName("activation_crystal"), new ItemSlate().setRegistryName("slate"), new ItemInscriptionTool().setRegistryName("inscription_tool"), new ItemSacrificialDagger().setRegistryName("sacrificial_dagger"), new ItemPackSacrifice().setRegistryName("pack_sacrifice"), new ItemPackSelfSacrifice().setRegistryName("pack_self_sacrifice"), new ItemDaggerOfSacrifice().setRegistryName("dagger_of_sacrifice"), new ItemRitualDiviner().setRegistryName("ritual_diviner"), new ItemRitualReader().setRegistryName("ritual_reader"), new ItemLavaCrystal().setRegistryName("lava_crystal"), new ItemBoundSword().setRegistryName("bound_sword"), new ItemBoundPickaxe().setRegistryName("bound_pickaxe"), new ItemBoundAxe().setRegistryName("bound_axe"), new ItemBoundShovel().setRegistryName("bound_shovel"), new ItemSigilDivination(true).setRegistryName("sigil_divination"), new ItemSigilAir().setRegistryName("sigil_air"), new ItemSigilWater().setRegistryName("sigil_water"), new ItemSigilLava().setRegistryName("sigil_lava"), new ItemSigilVoid().setRegistryName("sigil_void"), new ItemSigilGreenGrove().setRegistryName("sigil_green_grove"), new ItemSigilBloodLight().setRegistryName("sigil_blood_light"), new ItemSigilElementalAffinity().setRegistryName("sigil_elemental_affinity"), new ItemSigilMagnetism().setRegistryName("sigil_magnetism"), new ItemSigilSuppression().setRegistryName("sigil_suppression"), new ItemSigilHaste().setRegistryName("sigil_haste"), new ItemSigilFastMiner().setRegistryName("sigil_fast_miner"), new ItemSigilDivination(false).setRegistryName("sigil_seer"), new ItemSigilPhantomBridge().setRegistryName("sigil_phantom_bridge"), new ItemSigilWhirlwind().setRegistryName("sigil_whirlwind"), new ItemSigilCompression().setRegistryName("sigil_compression"), new ItemSigilEnderSeverance().setRegistryName("sigil_ender_severance"), new ItemSigilHolding().setRegistryName("sigil_holding"), new ItemSigilTeleposition().setRegistryName("sigil_teleposition"), new ItemSigilTransposition().setRegistryName("sigil_transposition"), new ItemSigilClaw().setRegistryName("sigil_claw"), new ItemSigilBounce().setRegistryName("sigil_bounce"), new ItemSigilFrost().setRegistryName("sigil_frost"), new ItemEnum.Variant<>(ComponentTypes.class, "baseComponent").setRegistryName("component"), new ItemDemonCrystal().setRegistryName("item_demon_crystal"), new ItemTelepositionFocus().setRegistryName("teleposition_focus"), new ItemExperienceBook().setRegistryName("experience_tome"), new ItemEnum.Variant<>(ShardType.class, "blood_shard").setRegistryName("blood_shard"), new ItemLivingArmour(EntityEquipmentSlot.HEAD).setRegistryName("living_armour_helmet"), new ItemLivingArmour(EntityEquipmentSlot.CHEST).setRegistryName("living_armour_chest"), new ItemLivingArmour(EntityEquipmentSlot.LEGS).setRegistryName("living_armour_leggings"), new ItemLivingArmour(EntityEquipmentSlot.FEET).setRegistryName("living_armour_boots"), new ItemSentientArmour(EntityEquipmentSlot.HEAD).setRegistryName("sentient_armour_helmet"), new ItemSentientArmour(EntityEquipmentSlot.CHEST).setRegistryName("sentient_armour_chest"), new ItemSentientArmour(EntityEquipmentSlot.LEGS).setRegistryName("sentient_armour_leggings"), new ItemSentientArmour(EntityEquipmentSlot.FEET).setRegistryName("sentient_armour_boots"), new ItemAltarMaker().setRegistryName("altar_maker"), new ItemUpgradeTome().setRegistryName("upgrade_tome"), new ItemUpgradeTrainer().setRegistryName("upgrade_trainer"), new ItemArcaneAshes().setRegistryName("arcane_ashes"), new ItemMonsterSoul().setRegistryName("monster_soul"), new ItemSoulGem().setRegistryName("soul_gem"), new ItemSoulSnare().setRegistryName("soul_snare"), new ItemSentientSword().setRegistryName("sentient_sword"), new ItemSentientBow().setRegistryName("sentient_bow"), new ItemSentientArmourGem().setRegistryName("sentient_armour_gem"), new ItemSentientAxe().setRegistryName("sentient_axe"), new ItemSentientPickaxe().setRegistryName("sentient_pickaxe"), new ItemSentientShovel().setRegistryName("sentient_shovel"), new ItemNodeRouter().setRegistryName("node_router"), new ItemRouterFilter().setRegistryName("base_item_filter"), new ItemFluidRouterFilter().setRegistryName("base_fluid_filter"), new ItemCuttingFluid().setRegistryName("cutting_fluid"), new ItemSanguineBook().setRegistryName("sanguine_book"), new ItemLivingArmourPointsUpgrade().setRegistryName("points_upgrade"), new ItemDemonWillGauge().setRegistryName("demon_will_gauge"), new ItemPotionFlask().setRegistryName("potion_flask"), new ItemAlchemicVial().setRegistryName("alchemic_vial")));
event.getRegistry().registerAll(items.toArray(new Item[0]));
}
Aggregations