use of net.minecraft.potion.PotionEffect in project takumicraft by TNTModders.
the class EntityTransCreeper method takumiExplodeEvent.
@Override
public boolean takumiExplodeEvent(Detonate event) {
event.getAffectedEntities().forEach(entity -> {
if (entity instanceof EntityPlayer) {
((EntityPlayer) entity).addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 60));
((EntityPlayer) entity).addPotionEffect(new PotionEffect(TakumiPotionCore.INVERSION, 60));
}
});
return true;
}
use of net.minecraft.potion.PotionEffect in project takumicraft by TNTModders.
the class EntityTransCreeper method onUpdate.
@Override
public void onUpdate() {
super.onUpdate();
this.bossInfo.setPercent(this.getHealth() / this.getMaxHealth());
this.world.playerEntities.forEach(player -> {
if (this.getDistanceSqToEntity(player) < 16) {
player.addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 60));
player.addPotionEffect(new PotionEffect(TakumiPotionCore.INVERSION, 60));
}
});
}
use of net.minecraft.potion.PotionEffect in project takumicraft by TNTModders.
the class EntitySpiderCreeper method onInitialSpawn.
/**
* Called only once on an entity when first time spawned, via egg, mob spawner, natural spawning etc, but not called
* when entity is reloaded from nbt. Mainly used for initializing attributes and inventory
*/
@Override
@Nullable
public IEntityLivingData onInitialSpawn(DifficultyInstance difficulty, @Nullable IEntityLivingData livingdata) {
livingdata = super.onInitialSpawn(difficulty, livingdata);
if (this.world.rand.nextInt(100) == 0) {
EntitySkeleton entityskeleton = new EntitySkeleton(this.world);
entityskeleton.setLocationAndAngles(this.posX, this.posY, this.posZ, this.rotationYaw, 0.0F);
entityskeleton.onInitialSpawn(difficulty, null);
this.world.spawnEntity(entityskeleton);
entityskeleton.startRiding(this);
}
if (livingdata == null) {
livingdata = new GroupData();
if (this.world.getDifficulty() == EnumDifficulty.HARD && this.world.rand.nextFloat() < 0.1F * difficulty.getClampedAdditionalDifficulty()) {
((GroupData) livingdata).setRandomEffect(this.world.rand);
}
}
if (livingdata instanceof GroupData) {
Potion potion = ((GroupData) livingdata).effect;
if (potion != null) {
this.addPotionEffect(new PotionEffect(potion, Integer.MAX_VALUE));
}
}
return livingdata;
}
use of net.minecraft.potion.PotionEffect in project takumicraft by TNTModders.
the class EntityLightCreeper method takumiExplodeEvent.
@Override
public boolean takumiExplodeEvent(Detonate event) {
for (Entity entity : event.getAffectedEntities()) {
if (entity instanceof EntityLivingBase) {
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.GLOWING, 400, 0));
}
}
float power = this.getPowered() ? 6f : 3f;
if (event.getExplosion() instanceof TakumiExplosion) {
power = ((TakumiExplosion) event.getExplosion()).getSize();
}
if (power > 0.5) {
for (BlockPos pos : event.getAffectedBlocks()) {
if (!this.world.isRemote && this.world.getBlockState(pos).getBlock().getLightValue(this.world.getBlockState(pos)) > 0.5f && TakumiUtils.takumiGetBlockResistance(this, this.world.getBlockState(pos), pos) != -1) {
this.world.setBlockToAir(pos);
TakumiUtils.takumiCreateExplosion(this.world, this, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, power - 0.2f, false, true);
}
}
}
return true;
}
use of net.minecraft.potion.PotionEffect in project takumicraft by TNTModders.
the class EntityLuckCreeper method takumiExplodeEvent.
@Override
public boolean takumiExplodeEvent(Detonate event) {
for (Entity entity : event.getAffectedEntities()) {
if (entity instanceof EntityLivingBase) {
((EntityLivingBase) entity).heal(((EntityLivingBase) entity).getMaxHealth());
((EntityLivingBase) entity).curePotionEffects(new ItemStack(Items.MILK_BUCKET));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.LUCK, 600, 1));
}
}
event.getAffectedEntities().clear();
return true;
}
Aggregations