use of net.minecraft.potion.PotionEffect in project ArsMagica2 by Mithion.
the class AMIngameGUI method getPotionEffectsByTimeRemaining.
private ArrayList<PotionEffect> getPotionEffectsByTimeRemaining() {
Iterator i = mc.thePlayer.getActivePotionEffects().iterator();
ArrayList<PotionEffect> potions = new ArrayList<PotionEffect>();
while (i.hasNext()) potions.add((PotionEffect) i.next());
Collections.sort(potions, durationComparator);
return potions;
}
use of net.minecraft.potion.PotionEffect in project OpenModularTurrets by OpenModularTurretsTeam.
the class RelativisticTurretTileEntity method update.
@SuppressWarnings("ConstantConditions")
@Override
public void update() {
setSide();
this.base = getBaseFromWorld();
if (this.getWorld().isRemote) {
if (rotationAnimation >= 360F) {
rotationAnimation = 0F;
}
rotationAnimation = rotationAnimation + 0.03F;
return;
}
ticks++;
// BASE IS OKAY
if (base == null || base.getTier() < this.turretTier) {
this.getWorld().destroyBlock(this.pos, true);
} else {
concealmentChecks();
TurretHeadUtil.updateSolarPanelAddon(base);
//turret tick rate;
if (target == null && targetingTicks < ConfigHandler.getTurretTargetSearchTicks()) {
targetingTicks++;
return;
}
targetingTicks = 0;
int power_required = Math.round(this.getTurretPowerUsage() * (1 - TurretHeadUtil.getEfficiencyUpgrades(base)) * (1 + TurretHeadUtil.getScattershotUpgrades(base)));
// power check
if ((base.getEnergyLevel(EnumFacing.DOWN) < power_required) || (!base.isActive())) {
return;
}
// is there a target, and Has it died in the previous tick?
if (target == null || target.isDead || this.getWorld().getEntityByID(target.getEntityId()) == null || ((EntityLivingBase) target).getHealth() <= 0.0F) {
target = getTargetWithoutEffect();
}
// did we even get a target previously?
if (target == null) {
return;
}
this.rotationXZ = TurretHeadUtil.getAimYaw(target, this.pos) + 3.2F;
this.rotationXY = TurretHeadUtil.getAimPitch(target, this.pos);
// has cooldown passed?
if (ticks < (this.getTurretFireRate() * (1 - TurretHeadUtil.getFireRateUpgrades(base)))) {
return;
}
// Can the turret still see the target? (It's moving)
if (target != null) {
if (!TurretHeadUtil.canTurretSeeTarget(this, (EntityLivingBase) target)) {
target = null;
return;
}
}
if (target != null && target instanceof EntityPlayerMP) {
EntityPlayerMP entity = (EntityPlayerMP) target;
if (isPlayerTrusted(entity, base)) {
target = null;
return;
}
}
if (target != null) {
if (chebyshevDistance(target, base)) {
target = null;
return;
}
}
// Consume energy
base.setEnergyStored(base.getEnergyLevel(EnumFacing.DOWN) - power_required);
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.getPotionById(2), 200, 5, false, false));
((EntityLivingBase) target).addPotionEffect(new PotionEffect(Potion.getPotionById(18), 200, 5, false, false));
target = null;
}
this.getWorld().playSound(null, this.getPos(), this.getLaunchSoundEffect(), SoundCategory.BLOCKS, 0.6F, 1.0F);
ticks = 0;
}
use of net.minecraft.potion.PotionEffect in project Witchworks by Um-Mitternacht.
the class ItemHoney method onFoodEaten.
@Override
protected void onFoodEaten(ItemStack stack, World worldIn, EntityPlayer player) {
player.addPotionEffect(new PotionEffect(MobEffects.HASTE, 450, 0));
player.addPotionEffect(new PotionEffect(MobEffects.LUCK, 450, 0));
}
use of net.minecraft.potion.PotionEffect in project Witchworks by Um-Mitternacht.
the class KettleCrafting method init.
public static void init() {
//------------------------------------Processing------------------------------------//
//Some recipes that return the non-dyed version of an Item
KettleRegistry.addKettleProcessing(FluidRegistry.WATER, Items.LEATHER_HELMET, Items.LEATHER_HELMET, false);
KettleRegistry.addKettleProcessing(FluidRegistry.WATER, Items.LEATHER_CHESTPLATE, Items.LEATHER_CHESTPLATE, false);
KettleRegistry.addKettleProcessing(FluidRegistry.WATER, Items.LEATHER_LEGGINGS, Items.LEATHER_LEGGINGS, false);
KettleRegistry.addKettleProcessing(FluidRegistry.WATER, Items.LEATHER_BOOTS, Items.LEATHER_BOOTS, false);
//Cooking with Oil
KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.PORKCHOP, Items.COOKED_PORKCHOP, true);
KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.MUTTON, Items.COOKED_MUTTON, true);
KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.RABBIT, Items.COOKED_RABBIT, true);
KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.CHICKEN, Items.COOKED_CHICKEN, true);
KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.BEEF, Items.COOKED_BEEF, true);
KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.FISH, Items.COOKED_FISH, true);
KettleRegistry.addKettleProcessing(Fluids.MUNDANE_OIL, Items.POTATO, Items.BAKED_POTATO, true);
//Coking with Water
KettleRegistry.addKettleProcessing(FluidRegistry.WATER, ModItems.EMPTY_HONEYCOMB, ModItems.WAX, true);
KettleRegistry.addKettleProcessing(FluidRegistry.WATER, ModItems.HONEYCOMB, ModItems.HONEY, true);
//------------------------------------Fluid Creation------------------------------------//
KettleRegistry.addKettleFluid(ModItems.HONEY, new FluidStack(Fluids.HONEY, 1000));
KettleRegistry.addKettleFluid(Items.POTATO, new FluidStack(Fluids.MUNDANE_OIL, 1000));
//------------------------------------Item Rituals------------------------------------//
//Todo: Better recipe for kelp seeds.
KettleRegistry.registerKettleItemRitual(new ItemRitual(getStack(ModItems.SEED_KELP), 5), getStack(Items.WHEAT_SEEDS, 1), Blocks.WATERLILY);
KettleRegistry.registerKettleItemRitual(new ItemRitual(getStack(Items.GOLDEN_APPLE, 1, 1), 8), getStack(Blocks.GOLD_BLOCK, 8), Items.APPLE);
//Todo: Sapling recipes once we add our own (to make it easier to get them without exploring, in the event a player cannot find them),
//Todo: Also gemstone amalgam for usage as a crafting ingredient. Also, the easter egg recipe and its achievement.
//------------------------------------Brew Recipes------------------------------------//
KettleRegistry.registerKettleBrewRecipe(BrewUtils.createBrew(ModItems.BREW_PHIAL_DRINK, ModBrews.SHELL_ARMOR), Items.BONE, ModItems.NEEDLE_BONE, getStack(ModBlocks.COQUINA, 3));
KettleRegistry.registerKettleBrewRecipe(BrewUtils.createBrew(ModItems.BREW_PHIAL_DRINK, ModBrews.INNER_FIRE), getStack(Items.BLAZE_ROD, 2), Items.GOLD_NUGGET, Items.BLAZE_POWDER);
KettleRegistry.registerKettleBrewRecipe(BrewUtils.createBrew(ModItems.BREW_PHIAL_DRINK, ModBrews.SPIDER_NIGHTMARE), getStack(Blocks.WEB, 10), getStack(Items.SPIDER_EYE, 5), Items.GHAST_TEAR, Items.FERMENTED_SPIDER_EYE);
KettleRegistry.registerKettleBrewRecipe(BrewUtils.createBrew(ModItems.BREW_PHIAL_DRINK, ModBrews.EXTINGUISH), getStack(Items.SNOWBALL, 2), Blocks.PACKED_ICE, ModItems.MINT);
//Todo: More brews, obviously. Just need ideas, really.
//------------------------------------Custom Brew Creation------------------------------------//
//Todo: Continue once more effects are added, such as new brews, and what not. Also when I get around to making the ingredients and what not.
KettleRegistry.addItemEffect(getStack(ModItems.SALT), new PotionEffect(MobEffects.BLINDNESS, 500), false);
KettleRegistry.addItemEffect(getStack(Items.ROTTEN_FLESH), new PotionEffect(MobEffects.HUNGER, 500), false);
KettleRegistry.addItemEffect(getStack(Blocks.END_STONE), new PotionEffect(MobEffects.LEVITATION, 500), false);
KettleRegistry.addItemEffect(getStack(Items.SPIDER_EYE), new PotionEffect(MobEffects.POISON, 500), false);
KettleRegistry.addItemEffect(getStack(Items.GHAST_TEAR), new PotionEffect(MobEffects.REGENERATION, 500), false);
KettleRegistry.addItemEffect(getStack(Items.GOLDEN_CARROT), new PotionEffect(MobEffects.NIGHT_VISION, 500), false);
KettleRegistry.addItemEffect(getStack(Items.SUGAR), new PotionEffect(MobEffects.SPEED, 500), false);
KettleRegistry.addItemEffect(getStack(Items.MAGMA_CREAM), new PotionEffect(MobEffects.FIRE_RESISTANCE, 500), false);
KettleRegistry.addItemEffect(getStack(Items.BLAZE_POWDER), new PotionEffect(MobEffects.STRENGTH, 500), false);
KettleRegistry.addItemEffect(getStack(Items.RABBIT_FOOT), new PotionEffect(MobEffects.JUMP_BOOST, 500), false);
KettleRegistry.addItemEffect(getStack(Items.SPECKLED_MELON), new PotionEffect(MobEffects.INSTANT_HEALTH, 1), false);
KettleRegistry.addItemEffect(getStack(Items.FISH, 1, 3), new PotionEffect(MobEffects.WATER_BREATHING, 500), false);
KettleRegistry.addItemEffect(getStack(Blocks.RED_FLOWER, 1, 1), new PotionEffect(MobEffects.LUCK, 500), false);
KettleRegistry.addItemEffect(getStack(ModItems.WAX), new PotionEffect(MobEffects.SLOWNESS, 500), false);
KettleRegistry.addItemEffect(getStack(Items.POISONOUS_POTATO), new PotionEffect(MobEffects.NAUSEA, 500), false);
KettleRegistry.addItemEffect(getStack(ModItems.BELLADONNA), new PotionEffect(MobEffects.WITHER, 500), false);
KettleRegistry.addItemEffect(getStack(ModItems.ASPHODEL), new PotionEffect(MobEffects.UNLUCK, 500), false);
KettleRegistry.addItemEffect(getStack(ModItems.LAVENDER), new PotionEffect(MobEffects.HASTE, 500), false);
KettleRegistry.addItemEffect(getStack(Items.PRISMARINE_CRYSTALS), new PotionEffect(MobEffects.GLOWING, 500), false);
KettleRegistry.addItemEffect(getStack(ModItems.KELP), new PotionEffect(MobEffects.WATER_BREATHING, 500), false);
KettleRegistry.addItemEffect(getStack(Items.PRISMARINE_SHARD), new PotionEffect(MobEffects.MINING_FATIGUE, 500), false);
KettleRegistry.addItemEffect(getStack(Items.SHULKER_SHELL), new PotionEffect(MobEffects.SLOWNESS, 500), false);
KettleRegistry.addItemEffect(getStack(ModBlocks.COQUINA), BrewRegistry.getDefault(ModBrews.SHELL_ARMOR), false);
KettleRegistry.addItemEffect(getStack(ModItems.MINT), BrewRegistry.getDefault(ModBrews.EXTINGUISH), false);
KettleRegistry.addItemModifier(getStack(Items.QUARTZ), new BrewSimpleModifier(2400, 0), true);
KettleRegistry.addItemModifier(getStack(Items.REDSTONE), new BrewSimpleModifier(600, 0), true);
KettleRegistry.addItemModifier(getStack(Blocks.REDSTONE_BLOCK), new BrewSimpleModifier(1200, 0), true);
KettleRegistry.addItemModifier(getStack(ModItems.NUUMMITE), new BrewSimpleModifier(0, 3), true);
KettleRegistry.addItemModifier(getStack(Items.GLOWSTONE_DUST), new BrewSimpleModifier(0, 1), true);
KettleRegistry.addItemModifier(getStack(Blocks.GLOWSTONE), new BrewSimpleModifier(0, 2), true);
}
use of net.minecraft.potion.PotionEffect in project Witchworks by Um-Mitternacht.
the class BrewUtils method serialize.
public static NBTTagCompound serialize(Collection<Object> collection) {
List<BrewEffect> brewEffects = new ArrayList<>();
List<PotionEffect> potionEffects = new ArrayList<>();
for (Object brew : collection) {
if (brew instanceof BrewEffect) {
brewEffects.add((BrewEffect) brew);
} else if (brew instanceof PotionEffect) {
potionEffects.add((PotionEffect) brew);
}
}
NBTTagCompound compound = new NBTTagCompound();
appendPotions(compound, mixPotions(potionEffects));
appendBrews(compound, mixBrews(brewEffects));
return compound;
}
Aggregations