use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.
the class DeathCapArtifact method finishUsing.
@Override
public ItemStack finishUsing(ItemStack stack, World world, LivingEntity user) {
for (int i = 0; i < 50; i++) {
rndDeath = (int) (Math.random() * (100 - 1 + 1) + 1);
}
if (rndDeath > 15 && rndDeath < 30) {
user.kill();
}
// Play Sound
user.playSound(EAT_DEATH_CAP_MUSHROOM, 1.0F, 1.0F);
// Apply Effects
world.getClosestPlayer(user, 15).addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 400, 2));
world.getClosestPlayer(user, 15).addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 400, 1));
// Set 30 second Cooldown
return this.isFood() ? user.eatFood(world, stack) : stack;
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.
the class EnchantersTomeArtifact method use.
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerEntity, Hand hand) {
// Play Sound
playerEntity.playSound(ENCHANTERS_TOME_ACTIVATE, 1.0F, 1.0F);
// Apply Effects to the Closest Players
world.getClosestPlayer(playerEntity, 15).addStatusEffect(new StatusEffectInstance(StatusEffects.STRENGTH, 400, 2));
world.getClosestPlayer(playerEntity, 15).addStatusEffect(new StatusEffectInstance(StatusEffects.SPEED, 400, 1));
world.getClosestPlayer(playerEntity, 15).addStatusEffect(new StatusEffectInstance(StatusEffects.HASTE, 400, 2));
// Add 25 second Cooldown
playerEntity.getItemCooldownManager().set(ItemRegistry.ENCHANTERS_TOME, 500);
return TypedActionResult.success(playerEntity.getStackInHand(hand));
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.
the class SoulHealerArtifact method use.
@Override
public TypedActionResult<ItemStack> use(World world, PlayerEntity playerEntity, Hand hand) {
if (((PlayerEntityAccess) playerEntity).neutrino$getPowerCount() >= 150) {
// Play Healer Sound
playerEntity.playSound(SoundRegister.SOUL_HEALER_ACTIVATE, 1.0F, 1.0F);
// Heal
world.getClosestPlayer(playerEntity, 15).addStatusEffect(new StatusEffectInstance(StatusEffects.INSTANT_HEALTH, 200, 2));
((PlayerEntityAccess) playerEntity).neutrino$setPowerCount(0);
} else {
if (world.isClient()) {
MinecraftClient.getInstance().inGameHud.addChatMessage(MessageType.GAME_INFO, Text.of("Not enough souls!"), UUID.randomUUID());
}
}
return TypedActionResult.success(playerEntity.getStackInHand(hand));
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Neutrino by FrostWizard4.
the class DaturaFlower method onBreak.
public void onBreak(World world, BlockPos pos, BlockState state, PlayerEntity player) {
this.spawnBreakParticles(world, player, pos, state);
if (state.isIn(BlockTags.GUARDED_BY_PIGLINS)) {
PiglinBrain.onGuardedBlockInteracted(player, false);
}
AreaEffectCloudEntity areaEffectCloudEntity = new AreaEffectCloudEntity(world, pos.getX(), pos.getY(), pos.getZ());
areaEffectCloudEntity.setRadius(3.0F);
areaEffectCloudEntity.setRadiusOnUse(-0.5F);
areaEffectCloudEntity.setWaitTime(10);
areaEffectCloudEntity.setRadiusGrowth(-areaEffectCloudEntity.getRadius() / (float) areaEffectCloudEntity.getDuration());
areaEffectCloudEntity.setPotion(Potions.POISON);
areaEffectCloudEntity.addEffect(new StatusEffectInstance(StatusEffects.POISON));
if (world.isDay()) {
world.spawnEntity(areaEffectCloudEntity);
}
world.emitGameEvent(player, GameEvent.BLOCK_DESTROY, pos);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Biome-Makeover by Lemonszz.
the class LightningBottleEntity method onCollision.
protected void onCollision(HitResult hitResult) {
super.onCollision(hitResult);
NetworkUtil.doLightningSplash(world, true, getBlockPos());
if (!this.world.isClient) {
world.playSound(null, getBlockPos(), BMEffects.BOTTLE_THUNDER, SoundCategory.NEUTRAL, 50F, 0.8F + this.random.nextFloat() * 0.2F);
Box box = this.getBoundingBox().expand(4.0D, 2.0D, 4.0D);
List<LivingEntity> entities = this.world.getEntitiesByClass(LivingEntity.class, box, EntityPredicates.VALID_LIVING_ENTITY);
if (!entities.isEmpty()) {
Iterator<LivingEntity> iterator = entities.iterator();
while (iterator.hasNext()) {
LivingEntity e = iterator.next();
double distance = this.squaredDistanceTo(e);
if (distance < 16.0D) {
int fireTicks = e.getFireTicks();
boolean isInvul = e.isInvulnerable();
LightningEntity dummyLightning = new LightningEntity(EntityType.LIGHTNING_BOLT, world);
dummyLightning.setPos(e.getX(), e.getY(), e.getZ());
e.setInvulnerable(true);
e.onStruckByLightning((ServerWorld) world, dummyLightning);
e.setFireTicks(fireTicks);
e.setInvulnerable(isInvul);
dummyLightning.remove();
}
}
}
// Loop through again to grab transformed entities for damage & effect
entities = this.world.getEntitiesByClass(LivingEntity.class, box, EntityPredicates.VALID_LIVING_ENTITY);
if (!entities.isEmpty()) {
Iterator<LivingEntity> iterator = entities.iterator();
while (iterator.hasNext()) {
LivingEntity e = iterator.next();
double distance = this.squaredDistanceTo(e);
if (distance < 16.0D) {
NetworkUtil.doLightningEntity(world, e, 100);
if (!e.hasStatusEffect(BMPotions.SHOCKED)) {
e.addStatusEffect(new StatusEffectInstance(BMPotions.SHOCKED, 1000, 0));
} else {
e.addStatusEffect(new StatusEffectInstance(BMPotions.SHOCKED, 1000, Math.min(3, e.getStatusEffect(BMPotions.SHOCKED).getAmplifier() + 1)));
}
e.damage(DamageSource.magic(this, this.getOwner()), 0);
if (getOwner() instanceof LivingEntity) {
e.setAttacker((LivingEntity) getOwner());
}
if (e.getHealth() > e.getMaxHealth())
e.setHealth(e.getMaxHealth());
}
}
}
this.remove();
}
}
Aggregations