use of net.minecraft.entity.effect.StatusEffectInstance in project LevelZ by Globox1997.
the class LivingEntityMixin method tryUseTotemMixin.
@Inject(method = "tryUseTotem", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/util/Hand;values()[Lnet/minecraft/util/Hand;"), cancellable = true)
private void tryUseTotemMixin(DamageSource source, CallbackInfoReturnable<Boolean> info) {
if ((Object) this instanceof PlayerEntity) {
PlayerEntity player = (PlayerEntity) (Object) this;
if (((PlayerStatsManagerAccess) player).getPlayerStatsManager(player).getLevel("luck") >= ConfigInit.CONFIG.maxLevel && player.world.random.nextFloat() < ConfigInit.CONFIG.luckSurviveChance) {
player.setHealth(1.0F);
player.clearStatusEffects();
player.addStatusEffect(new StatusEffectInstance(StatusEffects.ABSORPTION, 100, 1));
player.addStatusEffect(new StatusEffectInstance(StatusEffects.FIRE_RESISTANCE, 600, 0));
info.setReturnValue(true);
}
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project Carrier by GabrielOlvH.
the class ServerWorldTickCallback method onEndTick.
@Override
public void onEndTick(ServerWorld serverWorld) {
for (ServerPlayerEntity player : serverWorld.getPlayers()) {
CarrierComponent carrier = Carrier.HOLDER.get(player);
CarryingData carrying = carrier.getCarryingData();
if (carrying != null) {
Config config = Carrier.CONFIG;
if (config.getSlownessLevel() > 0)
player.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 20, config.getSlownessLevel() - 1));
if (config.getHungerExhaustion() > 0)
player.getHungerManager().addExhaustion(config.getHungerExhaustion());
}
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class RampagingEnchantmentMixin method onRampagingEnchantmentKill.
@Inject(at = @At("HEAD"), method = "onDeath", cancellable = true)
private void onRampagingEnchantmentKill(DamageSource source, CallbackInfo ci) {
if (!(source.getAttacker() instanceof PlayerEntity))
return;
LivingEntity user = (LivingEntity) source.getAttacker();
ItemStack mainHandStack = null;
if (user != null) {
mainHandStack = user.getMainHandStack();
}
boolean uniqueWeaponFlag = false;
if (McdwEnchantsConfig.getValue("rampaging")) {
if (mainHandStack != null && (EnchantmentHelper.getLevel(EnchantsRegistry.RAMPAGING, mainHandStack) >= 1)) {
int level = EnchantmentHelper.getLevel(EnchantsRegistry.RAMPAGING, mainHandStack);
float rampagingRand = user.getRandom().nextFloat();
if (rampagingRand <= 0.1F) {
StatusEffectInstance rampage = new StatusEffectInstance(StatusEffects.HASTE, level * 100, 2, false, false);
user.addStatusEffect(rampage);
}
}
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class AOECloudHelper method spawnRegenCloud.
// Regen Cloud
public static void spawnRegenCloud(LivingEntity user, int amplifier) {
AreaEffectCloudEntity areaEffectCloudEntity = new AreaEffectCloudEntity(user.world, user.getX(), user.getY(), user.getZ());
areaEffectCloudEntity.setOwner(user);
areaEffectCloudEntity.setRadius(5.0F);
areaEffectCloudEntity.setRadiusOnUse(-0.5F);
areaEffectCloudEntity.setWaitTime(10);
areaEffectCloudEntity.setDuration(100);
StatusEffectInstance regeneration = new StatusEffectInstance(StatusEffects.REGENERATION, 100, amplifier);
areaEffectCloudEntity.addEffect(regeneration);
user.world.spawnEntity(areaEffectCloudEntity);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class AOECloudHelper method spawnPoisonCloud.
// Poison Cloud
public static void spawnPoisonCloud(LivingEntity user, LivingEntity target, int amplifier) {
AreaEffectCloudEntity areaEffectCloudEntity = new AreaEffectCloudEntity(target.world, target.getX(), target.getY(), target.getZ());
areaEffectCloudEntity.setOwner(user);
areaEffectCloudEntity.setRadius(5.0F);
areaEffectCloudEntity.setRadiusOnUse(-0.5F);
areaEffectCloudEntity.setWaitTime(10);
areaEffectCloudEntity.setDuration(60);
StatusEffectInstance poison = new StatusEffectInstance(StatusEffects.POISON, 60, amplifier);
areaEffectCloudEntity.addEffect(poison);
target.world.spawnEntity(areaEffectCloudEntity);
}
Aggregations