use of net.minecraft.potion.PotionEffect in project BloodMagic by WayofTime.
the class ItemPotionFlask method onItemUseFinish.
@Override
public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase entityLiving) {
EntityPlayer player = entityLiving instanceof EntityPlayer ? (EntityPlayer) entityLiving : null;
int remainingUses = stack.getMaxDamage() - stack.getItemDamage();
if (remainingUses <= 0) {
NBTHelper.checkNBT(stack);
stack.getTagCompound().setBoolean("empty", true);
return stack;
}
if (player == null || !player.capabilities.isCreativeMode) {
stack.setItemDamage(stack.getItemDamage() + 1);
}
if (!world.isRemote) {
for (PotionEffect potioneffect : PotionUtils.getEffectsFromStack(stack)) {
entityLiving.addPotionEffect(new PotionEffect(potioneffect));
}
}
return stack;
}
use of net.minecraft.potion.PotionEffect 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 net.minecraft.potion.PotionEffect in project BloodMagic by WayofTime.
the class PotionBloodMagic method apply.
public PotionEffect apply(EntityLivingBase entity, int duration, int level) {
PotionEffect effect = new PotionEffect(this, duration, level, false, false);
entity.addPotionEffect(effect);
return effect;
}
use of net.minecraft.potion.PotionEffect in project BloodMagic by WayofTime.
the class LivingArmourUpgradeNightSight method onTick.
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
if (world.getLight(player.getPosition()) <= 9) {
isActive = true;
if (player.isPotionActive(MobEffects.NIGHT_VISION)) {
int dur = player.getActivePotionEffect(MobEffects.NIGHT_VISION).getDuration();
if (dur > 100 && dur < 20 * 60 * 20) {
// Don't override the potion effect if the other potion effect is sufficiently long.
return;
}
}
player.addPotionEffect(new PotionEffect(MobEffects.NIGHT_VISION, Constants.Misc.NIGHT_VISION_CONSTANT_BEGIN, 0, false, false));
} else {
isActive = false;
}
}
use of net.minecraft.potion.PotionEffect in project BloodMagic by WayofTime.
the class LivingArmourUpgradePoisonResist method onTick.
@Override
public void onTick(World world, EntityPlayer player, ILivingArmour livingArmour) {
if (player.isPotionActive(MobEffects.POISON) && poisonCooldown <= 0) {
PotionEffect eff = player.getActivePotionEffect(MobEffects.POISON);
if (eff.getAmplifier() <= poisonMaxCure[this.level]) {
player.removePotionEffect(MobEffects.POISON);
poisonCooldown = poisonCooldownTime[this.level];
player.sendStatusMessage(new TextComponentString(TextHelper.localize(chatBase + "poisonRemove")), true);
}
} else if (poisonCooldown > 0) {
poisonCooldown--;
}
}
Aggregations