Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package fr.tesm.module.magic.common.potion;
- import fr.tesm.main.common.core.PlayerProps;
- import java.awt.Color;
- import net.minecraft.entity.EntityLivingBase;
- import net.minecraft.entity.player.EntityPlayer;
- import net.minecraft.potion.Potion;
- import net.minecraft.util.ResourceLocation;
- public class EffectPotion extends Potion
- {
- public static Potion mana;
- public static Potion stamina;
- public static Potion health;
- protected EffectPotion(int potionID, ResourceLocation location, boolean badEffect, int potionColor, String name)
- {
- super(potionID, location, badEffect, potionColor);
- this.setPotionName("potion." + name);
- }
- @Override
- protected EffectPotion setIconIndex(int x, int y)
- {
- super.setIconIndex(x, y);
- return this;
- }
- @Override
- public void performEffect(EntityLivingBase entity, int level)
- {
- super.performEffect(entity, level);
- if(entity instanceof EntityPlayer)
- {
- PlayerProps props = PlayerProps.get((EntityPlayer)entity);
- if(props != null)
- {
- if(this.id == mana.id)
- {
- props.addMana(5);
- }
- if(this.id == stamina.id)
- {
- props.addStamina(5);
- }
- if(this.id == health.id)
- {
- float maxHeal = entity.getMaxHealth();
- if(entity.getHealth() < maxHeal)
- {
- float regen = maxHeal / 6000;
- entity.heal(regen);
- System.out.println(entity.getHealth());
- }
- }
- System.out.println(health.id);
- }
- }
- System.out.println(entity);
- }
- public static void loadEffect()
- {
- mana = new EffectPotion(25, new ResourceLocation("mana"), false, Color.cyan.getRGB(), "mana").setEffectiveness(0.25D);
- stamina = new EffectPotion(26, new ResourceLocation("stamina"), false, Color.green.getRGB(), "stamina").setEffectiveness(0.25D);
- health = new EffectPotion(27, new ResourceLocation("health"), false, Color.red.getRGB(), "health").setEffectiveness(0.25D);
- }
- public static void register()
- {
- Potion.potionTypes[mana.getId()] = mana;
- Potion.potionTypes[stamina.getId()] = stamina;
- Potion.potionTypes[health.getId()] = health;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement