2015-12-27 19:38:12 -05:00
|
|
|
package WayofTime.bloodmagic.potion;
|
|
|
|
|
2016-07-12 16:57:22 -04:00
|
|
|
import WayofTime.bloodmagic.api.Constants;
|
|
|
|
import net.minecraft.client.Minecraft;
|
|
|
|
import net.minecraft.entity.EntityLivingBase;
|
2015-12-27 19:38:12 -05:00
|
|
|
import net.minecraft.potion.Potion;
|
2016-07-12 16:57:22 -04:00
|
|
|
import net.minecraft.potion.PotionEffect;
|
2015-12-27 19:38:12 -05:00
|
|
|
import net.minecraft.util.ResourceLocation;
|
2016-07-12 16:57:22 -04:00
|
|
|
import net.minecraftforge.fml.relauncher.Side;
|
|
|
|
import net.minecraftforge.fml.relauncher.SideOnly;
|
2015-12-27 19:38:12 -05:00
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public class PotionBloodMagic extends Potion
|
|
|
|
{
|
2016-07-12 16:57:22 -04:00
|
|
|
public static ResourceLocation texture = new ResourceLocation(Constants.Mod.MODID, "textures/misc/potions.png");
|
|
|
|
|
2015-12-30 15:34:40 -05:00
|
|
|
public PotionBloodMagic(String name, ResourceLocation texture, boolean badEffect, int potionColor, int iconIndexX, int iconIndexY)
|
|
|
|
{
|
2016-03-18 14:54:31 -04:00
|
|
|
super(badEffect, potionColor);
|
2015-12-27 19:38:12 -05:00
|
|
|
this.setPotionName(name);
|
|
|
|
this.setIconIndex(iconIndexX, iconIndexY);
|
|
|
|
}
|
2016-07-12 16:57:22 -04:00
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean shouldRenderInvText(PotionEffect effect)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
public PotionEffect apply(EntityLivingBase entity, int duration)
|
|
|
|
{
|
|
|
|
return apply(entity, duration, 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
public PotionEffect apply(EntityLivingBase entity, int duration, int level)
|
|
|
|
{
|
|
|
|
PotionEffect effect = new PotionEffect(this, duration, level, false, false);
|
|
|
|
entity.addPotionEffect(effect);
|
|
|
|
return effect;
|
|
|
|
}
|
|
|
|
|
|
|
|
public int getLevel(EntityLivingBase entity)
|
|
|
|
{
|
|
|
|
PotionEffect effect = entity.getActivePotionEffect(this);
|
|
|
|
if (effect != null)
|
|
|
|
{
|
|
|
|
return effect.getAmplifier();
|
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean shouldRender(PotionEffect effect)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@SideOnly(Side.CLIENT)
|
|
|
|
public int getStatusIconIndex()
|
|
|
|
{
|
|
|
|
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
|
|
|
|
|
|
|
|
return super.getStatusIconIndex();
|
|
|
|
}
|
2015-12-27 19:38:12 -05:00
|
|
|
}
|