Fixed the bound sword so that it now drops weak blood shards.

This commit is contained in:
WayofTime 2016-01-30 22:22:46 -05:00
parent 77e8f5b494
commit d5670b5f0e
3 changed files with 22 additions and 30 deletions

View file

@ -5,6 +5,7 @@ Version 2.0.0-14
- FMLInterModComs.sendMessage("BloodMagic", "teleposerBlacklist", ItemStack)
- FMLInterModComs.sendMessage("BloodMagic", "sacrificeValue", "ClassName;Value")
- FMLInterModComs.sendMessage("BloodMagic", "greenGroveBlacklist", "domain:name")
- Fixed the bound sword so that it now drops weak blood shards.
------------------------------------------------------
Version 2.0.0-13

View file

@ -1,22 +1,20 @@
package WayofTime.bloodmagic.potion;
import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.registry.ModPotions;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.IProjectile;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.*;
import net.minecraftforge.event.entity.living.EnderTeleportEvent;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingEvent;
import net.minecraftforge.fml.common.eventhandler.EventPriority;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import java.util.List;
import WayofTime.bloodmagic.registry.ModPotions;
public class PotionEventHandlers
{
@ -116,25 +114,6 @@ public class PotionEventHandlers
}
}
@SubscribeEvent
public void onEntityDrop(LivingDropsEvent event)
{
if (event.source.getDamageType().equals("player"))
{
double rand = Math.random();
if (!(event.entityLiving instanceof EntityAnimal))
{
PotionEffect effect = event.entityLiving.getActivePotionEffect(Potion.weakness);
if (effect != null)
if (effect.getAmplifier() >= 2)
if (rand < 0.2)
event.entityLiving.dropItem(ModItems.bloodShard, 1);
}
}
}
@SubscribeEvent(priority = EventPriority.HIGHEST)
public void onPlayerDamageEvent(LivingAttackEvent event)
{

View file

@ -9,6 +9,7 @@ import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.entity.projectile.EntityArrow;
@ -46,15 +47,15 @@ import WayofTime.bloodmagic.item.ItemAltarMaker;
import WayofTime.bloodmagic.item.armour.ItemLivingArmour;
import WayofTime.bloodmagic.item.gear.ItemPackSacrifice;
import WayofTime.bloodmagic.livingArmour.LivingArmour;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerArrowShot;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerDigging;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerHealthboost;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerMeleeDamage;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerPhysicalProtect;
import WayofTime.bloodmagic.livingArmour.tracker.StatTrackerSelfSacrifice;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeArrowShot;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeDigging;
import WayofTime.bloodmagic.livingArmour.upgrade.LivingArmourUpgradeSelfSacrifice;
import WayofTime.bloodmagic.registry.ModBlocks;
import WayofTime.bloodmagic.registry.ModItems;
import WayofTime.bloodmagic.registry.ModPotions;
@ -379,6 +380,17 @@ public class EventHandler
}
}
}
if (heldStack != null && heldStack.getItem() == ModItems.boundSword && !(attackedEntity instanceof EntityAnimal))
{
for (int i = 0; i <= EnchantmentHelper.getLootingModifier(attackingEntity); i++)
{
if (this.random.nextDouble() < 0.2)
{
event.drops.add(new EntityItem(attackedEntity.worldObj, attackedEntity.posX, attackedEntity.posY, attackedEntity.posZ, new ItemStack(ModItems.bloodShard, 1, 0)));
}
}
}
}
}