use of net.minecraft.potion.PotionEffect in project BaseMetals by MinecraftModDevelopmentMods.
the class TraitToxic method afterHit.
@Override
public void afterHit(@Nonnull final ItemStack tool, @Nonnull final EntityLivingBase player, @Nonnull final EntityLivingBase target, @Nonnull final float damageDealt, @Nonnull final boolean wasCritical, @Nonnull final boolean wasHit) {
if (wasHit && target.isEntityAlive()) {
target.addPotionEffect(new PotionEffect(MobEffects.POISON, 100, 2));
target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 50));
}
}
use of net.minecraft.potion.PotionEffect in project BaseMetals by MinecraftModDevelopmentMods.
the class ModifierToxic method afterHit.
@Override
public void afterHit(@Nonnull final ItemStack tool, @Nonnull final EntityLivingBase player, @Nonnull final EntityLivingBase target, @Nonnull final float damageDealt, @Nonnull final boolean wasCritical, @Nonnull final boolean wasHit) {
if (wasHit && target.isEntityAlive()) {
target.addPotionEffect(new PotionEffect(MobEffects.POISON, 50, 1));
target.addPotionEffect(new PotionEffect(MobEffects.BLINDNESS, 10));
}
}
use of net.minecraft.potion.PotionEffect in project BaseMetals by MinecraftModDevelopmentMods.
the class Fluids method addFluidBlock.
@Nullable
protected static BlockFluidClassic addFluidBlock(@Nonnull final MMDMaterial material) {
if (material.getFluidBlock() != null) {
return material.getFluidBlock();
}
BlockFluidClassic block;
String name = material.getName();
if (name == null) {
return null;
}
if (!name.equals(MaterialNames.MERCURY)) {
block = new BlockFluidClassic(material.getFluid(), Material.LAVA);
} else {
block = new InteractiveFluidBlock(getFluidByName(name), false, (World w, EntityLivingBase e) -> {
if (w.rand.nextInt(32) == 0) {
e.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 30 * 20, 2));
}
});
}
// fullName
block.setRegistryName(name);
block.setUnlocalizedName(block.getRegistryName().getResourceDomain() + "." + name);
material.addNewBlock("fluid", block);
block.setCreativeTab(CreativeTabs.MISC);
final ItemBlock itemBlock = new ItemBlock(block);
// fullName
itemBlock.setRegistryName(name);
itemBlock.setUnlocalizedName(block.getRegistryName().getResourceDomain() + "." + name);
material.addNewItem("fluidItemBlock", itemBlock);
material.setFluidBlock(block);
return fluidBlockRegistry.put(name, block);
}
use of net.minecraft.potion.PotionEffect in project ForestryMC by ForestryMC.
the class AlleleEffectPotion method doEffectThrottled.
@Override
public IEffectData doEffectThrottled(IBeeGenome genome, IEffectData storedData, IBeeHousing housing) {
World world = housing.getWorldObj();
List<EntityLivingBase> entities = getEntitiesInRange(genome, housing, EntityLivingBase.class);
for (EntityLivingBase entity : entities) {
if (world.rand.nextFloat() >= chance) {
continue;
}
int dur = this.duration;
if (potion.isBadEffect()) {
// Entities are not attacked if they wear a full set of apiarist's armor.
int count = BeeManager.armorApiaristHelper.wearsItems(entity, getUID(), true);
if (count >= 4) {
// Full set, no damage/effect
continue;
} else if (count == 3) {
dur = this.duration / 4;
} else if (count == 2) {
dur = this.duration / 2;
} else if (count == 1) {
dur = this.duration * 3 / 4;
}
} else {
// don't apply positive effects to mobs
if (entity instanceof IMob) {
continue;
}
}
entity.addPotionEffect(new PotionEffect(potion, dur, 0));
}
return storedData;
}
use of net.minecraft.potion.PotionEffect in project Tropicraft by Tropicraft.
the class EntityPoisonBlot method onImpact.
@Override
protected void onImpact(RayTraceResult mop) {
if (mop.entityHit != null) {
if (mop.entityHit instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) mop.entityHit;
player.addPotionEffect(new PotionEffect(MobEffects.POISON, 12 * 20, 0));
this.setDead();
}
}
}
Aggregations