use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class AbilityHelper method stealSpeedFromTarget.
public static void stealSpeedFromTarget(LivingEntity user, LivingEntity target, int amplifier) {
StatusEffectInstance speed = new StatusEffectInstance(StatusEffects.SPEED, 80, amplifier);
StatusEffectInstance slowness = new StatusEffectInstance(StatusEffects.SLOWNESS, 80, amplifier);
user.addStatusEffect(speed);
target.addStatusEffect(slowness);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsWeapons by chronosacaria.
the class AbilityHelper method causeFreezing.
public static void causeFreezing(LivingEntity target, int amplifier) {
StatusEffectInstance freezing = new StatusEffectInstance(StatusEffects.SLOWNESS, 60, amplifier);
StatusEffectInstance miningFatigue = new StatusEffectInstance(StatusEffects.MINING_FATIGUE, 60, amplifier);
target.addStatusEffect(freezing);
target.addStatusEffect(miningFatigue);
}
use of net.minecraft.entity.effect.StatusEffectInstance in project BedrockIfy by juancarloscp52.
the class InGameHudMixin method renderStatusEffectOverlay.
/**
* Render the status effect overlay with the screen border distance applied.
*/
@Inject(method = "renderStatusEffectOverlay", at = @At("HEAD"), cancellable = true)
public void renderStatusEffectOverlay(MatrixStack matrixStack, CallbackInfo info) {
Collection<StatusEffectInstance> collection = Objects.requireNonNull(this.client.player).getStatusEffects();
if (!collection.isEmpty()) {
RenderSystem.enableBlend();
int beneficialEffects = 0;
int harmfulEffects = 0;
StatusEffectSpriteManager statusEffectSpriteManager = this.client.getStatusEffectSpriteManager();
List<Runnable> list = Lists.newArrayListWithExpectedSize(collection.size());
this.client.getTextureManager().bindTexture(HandledScreen.BACKGROUND_TEXTURE);
for (StatusEffectInstance statusEffectInstance : Ordering.natural().reverse().sortedCopy(collection)) {
StatusEffect statusEffect = statusEffectInstance.getEffectType();
if (statusEffectInstance.shouldShowIcon()) {
int x = this.scaledWidth - screenBorder;
int y = 1 + screenBorder;
if (this.client.isDemo()) {
y += 15;
}
if (statusEffect.isBeneficial()) {
++beneficialEffects;
x -= 25 * beneficialEffects;
} else {
++harmfulEffects;
x -= 25 * harmfulEffects;
y += 26;
}
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
float spriteAlpha = 1.0F;
if (statusEffectInstance.isAmbient()) {
this.drawTexture(matrixStack, x, y, 165, 166, 24, 24);
} else {
this.drawTexture(matrixStack, x, y, 141, 166, 24, 24);
if (statusEffectInstance.getDuration() <= 200) {
int m = 10 - statusEffectInstance.getDuration() / 20;
spriteAlpha = MathHelper.clamp((float) statusEffectInstance.getDuration() / 10.0F / 5.0F * 0.5F, 0.0F, 0.5F) + MathHelper.cos((float) statusEffectInstance.getDuration() * 3.1415927F / 5.0F) * MathHelper.clamp((float) m / 10.0F * 0.25F, 0.0F, 0.25F);
}
}
Sprite sprite = statusEffectSpriteManager.getSprite(statusEffect);
int finalX = x + 3;
int finalY = y + 3;
float finalAlpha = spriteAlpha;
list.add(() -> {
this.client.getTextureManager().bindTexture(sprite.getAtlas().getId());
RenderSystem.color4f(1.0F, 1.0F, 1.0F, finalAlpha);
drawSprite(matrixStack, finalX, finalY, this.getZOffset(), 18, 18, sprite);
});
}
}
list.forEach(Runnable::run);
}
info.cancel();
}
use of net.minecraft.entity.effect.StatusEffectInstance in project ImmersivePortalsMod by qouteall.
the class EndPortalEntity method onEntityTeleportedOnServer.
@Override
public void onEntityTeleportedOnServer(Entity entity) {
if (shouldAddSlowFalling(entity)) {
LivingEntity livingEntity = (LivingEntity) entity;
livingEntity.addPotionEffect(new StatusEffectInstance(StatusEffects.SLOW_FALLING, // duration
120, // amplifier
1));
}
if (entity instanceof ServerPlayerEntity) {
generateObsidianPlatform();
}
}
use of net.minecraft.entity.effect.StatusEffectInstance in project MCDungeonsArmors by chronosacaria.
the class EnchantmentEffects method applyChilling.
public static void applyChilling(LivingEntity wearer, LivingEntity livingEntity) {
int chillingLevel = EnchantmentHelper.getEquipmentLevel(EnchantsRegistry.enchants.get(CHILLING), wearer);
if (chillingLevel > 0) {
livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.SLOWNESS, 20 * chillingLevel, chillingLevel * 2 - 1));
livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.MINING_FATIGUE, 20 * chillingLevel, chillingLevel * 2 - 1));
}
}
Aggregations