use of net.minecraft.potion.Potion in project harvestcraft by MatrexsVigil.
the class ItemPamPotionFood method addDefaultSpeedPotionEffect.
public ItemPamPotionFood addDefaultSpeedPotionEffect() {
setAlwaysEdible();
final Potion potion = Potion.getPotionFromResourceLocation("speed");
if (potion == null) {
FMLLog.bigWarning("Could not set potion effect.");
return this;
}
setPotionEffect(new PotionEffect(potion, 600, 0), 0.8F);
return this;
}
use of net.minecraft.potion.Potion in project ImmersiveEngineering by BluSunrize.
the class ThaumcraftHelper method init.
@Override
public void init() {
FMLInterModComms.sendMessage("thaumcraft", "harvestStackedCrop", new ItemStack(IEContent.blockCrop, 5));
Potion potion_ward = Potion.getPotionFromResourceLocation("thaumcraft:warpward");
if (potion_ward != null)
ChemthrowerHandler.registerEffect("purifying_fluid", new ChemthrowerEffect_Potion(null, 0, potion_ward, 100, 0));
try {
Class c_DamageSourceThaumcraft = Class.forName("thaumcraft.api.damagesource.DamageSourceThaumcraft");
if (c_DamageSourceThaumcraft != null) {
DamageSource dmg_dissolve = (DamageSource) c_DamageSourceThaumcraft.getField("dissolve").get(null);
ChemthrowerHandler.registerEffect("liquid_death", new ChemthrowerEffect_Damage(dmg_dissolve, 4));
}
} catch (Exception e) {
}
try {
Class c_TileSmelter = Class.forName("thaumcraft.common.tiles.essentia.TileSmelter");
if (c_TileSmelter != null)
ExternalHeaterHandler.registerHeatableAdapter(c_TileSmelter, new AlchemyFurnaceAdapter(c_TileSmelter));
} catch (Exception e) {
}
}
use of net.minecraft.potion.Potion in project BetterRain by OreCruncher.
the class PotionHUD method doRender.
public void doRender(final RenderGameOverlayEvent event) {
if (event.isCancelable() || event.type != ElementType.EXPERIENCE) {
return;
}
final int TEXT_POTION_NAME = (int) (255 * ModOptions.potionHudTransparency) << 24 | 0xFFFFFF;
final int TEXT_DURATION = (int) (255 * ModOptions.potionHudTransparency) << 24 | 0x7F7F7F;
final int TEXT_DURATION_LOW = (int) (255 * ModOptions.potionHudTransparency) << 24 | 0xFF0000;
final float GUITOP = ModOptions.potionHudTopOffset;
final float GUILEFT = ModOptions.potionHudLeftOffset;
final float SCALE = ModOptions.potionHudScale;
final Minecraft mc = Minecraft.getMinecraft();
final FontRenderer font = mc.fontRendererObj;
final EntityPlayer player = Minecraft.getMinecraft().thePlayer;
int guiLeft = 2;
int guiTop = 2;
final Collection<PotionEffect> collection = player.getActivePotionEffects();
if (!collection.isEmpty()) {
GL11.glPushMatrix();
GL11.glColor4f(1.0F, 1.0F, 1.0F, ModOptions.potionHudTransparency);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glTranslatef(GUILEFT, GUITOP, 0.0F);
GL11.glScalef(SCALE, SCALE, SCALE);
int k = 33;
if (collection.size() > 7) {
k = 198 / (collection.size() - 1);
}
for (Iterator<PotionEffect> iterator = collection.iterator(); iterator.hasNext(); guiTop += k) {
final PotionEffect potioneffect = iterator.next();
final Potion potion = Potion.potionTypes[potioneffect.getPotionID()];
GL11.glColor4f(1.0F, 1.0F, 1.0F, ModOptions.potionHudTransparency);
mc.getTextureManager().bindTexture(TEXTURE);
this.drawTexturedModalRect(guiLeft, guiTop, 0, 166, 140, 32);
if (potion.hasStatusIcon()) {
int l = potion.getStatusIconIndex();
this.drawTexturedModalRect(guiLeft + 6, guiTop + 7, 0 + l % 8 * 18, 198 + l / 8 * 18, 18, 18);
}
try {
potion.renderInventoryEffect(guiLeft, guiTop, potioneffect, mc);
} catch (final Exception ex) {
;
}
if (!potion.shouldRenderInvText(potioneffect))
continue;
String s1 = I18n.format(potion.getName(), new Object[0]);
if (potioneffect.getAmplifier() == 1) {
s1 = s1 + " " + I18n.format("enchantment.level.2", new Object[0]);
} else if (potioneffect.getAmplifier() == 2) {
s1 = s1 + " " + I18n.format("enchantment.level.3", new Object[0]);
} else if (potioneffect.getAmplifier() == 3) {
s1 = s1 + " " + I18n.format("enchantment.level.4", new Object[0]);
}
font.drawStringWithShadow(s1, guiLeft + 10 + 18, guiTop + 6, TEXT_POTION_NAME);
String s = Potion.getDurationString(potioneffect);
font.drawStringWithShadow(s, guiLeft + 10 + 18, guiTop + 6 + 10, potioneffect.getDuration() <= 200 ? TEXT_DURATION_LOW : TEXT_DURATION);
}
GL11.glPopMatrix();
}
}
use of net.minecraft.potion.Potion in project BetterStorage by copygirl.
the class ItemDrinkingHelmet method use.
public static void use(EntityPlayer player) {
ItemStack drinkingHelmet = getDrinkingHelmet(player);
if (drinkingHelmet == null)
return;
int uses = StackUtils.get(drinkingHelmet, 0, "uses");
if (uses <= 0)
return;
ItemStack[] potions = StackUtils.getStackContents(drinkingHelmet, 2);
List<PotionEffect> potionEffects = new ArrayList<PotionEffect>();
for (ItemStack item : potions) if (item.getItem() instanceof ItemPotion) {
List<PotionEffect> effects = ((ItemPotion) item.getItem()).getEffects(item);
if (effects != null)
potionEffects.addAll(effects);
}
for (PotionEffect effect : potionEffects) {
Potion potion = Potion.potionTypes[effect.getPotionID()];
PotionEffect active = player.getActivePotionEffect(potion);
effect = new SmallPotionEffect(effect, active);
player.addPotionEffect(effect);
}
player.worldObj.playSoundAtEntity(player, "random.drink", 0.5F, 0.9F + player.worldObj.rand.nextFloat() * 0.1F);
if (--uses <= 0)
setPotions(drinkingHelmet, null);
else
StackUtils.set(drinkingHelmet, uses, "uses");
}
use of net.minecraft.potion.Potion in project BetterStorage by copygirl.
the class SmallPotionEffect method performEffect.
@Override
public void performEffect(EntityLivingBase entity) {
int smallEffect = 6 * (getAmplifier() + 1) / ItemDrinkingHelmet.maxUses;
Potion potion = Potion.potionTypes[getPotionID()];
if (entity.isEntityUndead() ? (potion == Potion.heal) : (potion == Potion.harm))
entity.attackEntityFrom(DamageSource.magic, smallEffect);
else if (potion == Potion.heal)
entity.heal(smallEffect);
else
super.performEffect(entity);
}
Aggregations