use of net.minecraft.potion.PotionEffect in project NewHorizonsCoreMod by GTNewHorizons.
the class ExtendedFluidCollection method populateFermentedBacterialSludge.
private static void populateFermentedBacterialSludge() {
Fluid tFermentedBacterialSludge = ModFluidManager.GetNewFluid("FermentedBacterialSludge");
tFermentedBacterialSludge.setGaseous(false);
tFermentedBacterialSludge.setViscosity(1000);
tFermentedBacterialSludge.setDensity(1);
tFermentedBacterialSludge.setLuminosity(8);
tFermentedBacterialSludge.setTemperature(300);
// The rarity of the fluid. Used primarily in tool tips.
tFermentedBacterialSludge.setRarity(EnumRarity.epic);
_mFermentedBacterialSludge = new ModSimpleBaseFluid(tFermentedBacterialSludge, Material.water);
// Add potion effects to the fluid if player steps into a pool
// Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
// Level 0: Potion Level I
// Level 1: Potion Level II
// ...
// For the duration: Set it low to vanish the effect as soon as the player leaves the pool
// If you set the duration to 200, the potion timer will start to tick for 10 seconds after
// the player has left the pool.
// Same for stacking potion effects, except that you want to set the duration to the amount which will be
// ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
// fluid block
_mFermentedBacterialSludge.addStackingPotionEffect(new PotionEffect(bop_loaded ? 24 : Potion.poison.id, 20, 0));
_mFermentedBacterialSludge.addStackingPotionEffect(new PotionEffect(bop_loaded ? 25 : Potion.moveSlowdown.id, 20, 0));
// don't register a bucket
_mFermentedBacterialSludge.setRegisterBucket(true);
}
use of net.minecraft.potion.PotionEffect in project NewHorizonsCoreMod by GTNewHorizons.
the class ExtendedFluidCollection method populateEnrichedBacterialSludge.
private static void populateEnrichedBacterialSludge() {
Fluid tEnrichedBacterialSludge = ModFluidManager.GetNewFluid("EnrichedBacterialSludge");
tEnrichedBacterialSludge.setGaseous(false);
tEnrichedBacterialSludge.setViscosity(1000);
tEnrichedBacterialSludge.setDensity(1);
tEnrichedBacterialSludge.setLuminosity(15);
tEnrichedBacterialSludge.setTemperature(300);
// The rarity of the fluid. Used primarily in tool tips.
tEnrichedBacterialSludge.setRarity(EnumRarity.epic);
_mEnrichedBacterialSludge = new ModSimpleBaseFluid(tEnrichedBacterialSludge, Material.water);
// Add potion effects to the fluid if player steps into a pool
// Syntax is: new PotionEffect(<potionID>, <duration in ticks>, <level>)
// Level 0: Potion Level I
// Level 1: Potion Level II
// ...
// For the duration: Set it low to vanish the effect as soon as the player leaves the pool
// If you set the duration to 200, the potion timer will start to tick for 10 seconds after
// the player has left the pool.
// Same for stacking potion effects, except that you want to set the duration to the amount which will be
// ADDED about each 0,5 seconds. So this poison-effect will increase as long as the player has contact with the
// fluid block
_mEnrichedBacterialSludge.addStackingPotionEffect(new PotionEffect(bop_loaded ? 24 : Potion.poison.id, 40, 0));
_mEnrichedBacterialSludge.addStackingPotionEffect(new PotionEffect(bop_loaded ? 25 : Potion.moveSlowdown.id, 40, 0));
// don't register a bucket
_mEnrichedBacterialSludge.setRegisterBucket(true);
}
use of net.minecraft.potion.PotionEffect in project BetterWithAddons by DaedalusGame.
the class EntityKarateZombie method fall.
@Override
public void fall(float distance, float damageMultiplier) {
float mult = damageMultiplier;
List<Entity> passengers = getPassengers();
if (getCurrentMove() == MartialArts.Suplex) {
passengers.forEach(this::forceDismount);
float[] ret = net.minecraftforge.common.ForgeHooks.onLivingFall(this, distance, damageMultiplier);
if (ret == null)
return;
distance = ret[0];
damageMultiplier = ret[1];
PotionEffect potioneffect = this.getActivePotionEffect(MobEffects.JUMP_BOOST);
float f = potioneffect == null ? 0.0F : (float) (potioneffect.getAmplifier() + 1);
int i = MathHelper.ceil((distance - 3.0F - f) * damageMultiplier);
if (i > 0) {
this.playSound(this.getFallSound(i), 1.0F, 1.0F);
for (Entity passenger : passengers) {
passenger.attackEntityFrom(DamageSource.causeMobDamage(this), (float) i);
}
}
mult = 0;
randomizeMove();
}
super.fall(distance, mult);
}
use of net.minecraft.potion.PotionEffect in project BetterWithAddons by DaedalusGame.
the class AnimalCrossbreedHandler method crossBreedAnimal.
@SubscribeEvent
public void crossBreedAnimal(LivingEvent.LivingUpdateEvent event) {
EntityLivingBase entity = event.getEntityLiving();
World world = entity.world;
BlockPos pos = entity.getPosition();
try {
if (!world.isRemote && entity instanceof EntityAnimal) {
EntityAnimal animal = (EntityAnimal) entity;
if (!animal.isInLove())
return;
if (world.getLight(pos) >= 8 || (int) inLove.get(animal) > 20)
return;
// Instead of expanding entity bounding box, expand block bounding box because it makes more sense this way probably
AxisAlignedBB aabb = new AxisAlignedBB(pos).expand(8, 8, 8);
List<EntityAnimal> others = world.getEntitiesWithinAABB(EntityAnimal.class, aabb);
EntityAnimal found = null;
for (EntityAnimal other : others) {
if (other == animal || !other.isInLove())
continue;
if (isSameSpecies(animal, other))
return;
if (animal.getPositionVector().squareDistanceTo(other.getPositionVector()) > 3.5 * 3.5)
continue;
if (!isNotSitting(other) || world.getLight(other.getPosition()) >= 8)
continue;
found = other;
break;
}
if (found == null)
return;
Vec3d spawnPos = new Vec3d((found.posX + animal.posX) / 2, (found.posY + animal.posY) / 2, (found.posZ + animal.posZ) / 2);
BlockPos spawnBlockPos = new BlockPos(spawnPos);
// TODO: Habitat check
final EntityAnimal finalFound = found;
ArrayList<AnimalMutation> mutations = mutationSet.stream().map(x -> x.copy().updateWeight(world, spawnPos, finalFound, animal)).collect(Collectors.toCollection(ArrayList::new));
AnimalMutation mutation = WeightedRandom.getRandomItem(world.rand, mutations);
if (mutation != null)
mutation.spawner.spawn(world, spawnPos, found, animal);
animal.resetInLove();
animal.setGrowingAge(6000);
found.resetInLove();
found.setGrowingAge(6000);
animal.playLivingSound();
found.playLivingSound();
animal.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 6000));
found.addPotionEffect(new PotionEffect(MobEffects.NAUSEA, 6000));
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
use of net.minecraft.potion.PotionEffect in project BetterWithAddons by DaedalusGame.
the class RenewablesHandler method feedBlaze.
@SubscribeEvent
public void feedBlaze(LivingEvent.LivingUpdateEvent event) {
if (!InteractionBWR.BLAZE_BREEDING)
return;
Entity entity = event.getEntity();
World world = entity.world;
Random random = world.rand;
BlockPos pos = entity.getPosition();
if (!world.isRemote && entity instanceof EntityBlaze) {
EntityBlaze blaze = (EntityBlaze) entity;
ArtificialBlaze blazeCap = blaze.getCapability(ARTIFICIAL_BLAZE_CAP, null);
blazeCap.breedingDelay--;
if (blazeCap.breedingDelay > 0)
return;
if (blazeCap.isArtificial) {
blaze.addPotionEffect(new PotionEffect(MobEffects.FIRE_RESISTANCE, 60000));
}
BlockPos checkPos = pos.add(random.nextInt(7) - 3, random.nextInt(7) - 3, random.nextInt(7) - 3);
if (!BiomeDictionary.hasType(world.getBiome(checkPos), BiomeDictionary.Type.NETHER)) {
blazeCap.breedingDelay = 6000;
return;
}
if (world.getBlockState(checkPos).getMaterial() != Material.FIRE)
return;
if (!consumeNearbyBlazeFood(world, pos))
return;
spawnArtificalBlaze(world, checkPos, blazeCap.isArtificial);
world.setBlockToAir(checkPos);
blazeCap.breedingDelay = 6000;
}
}
Aggregations