com.magistuarmory.effects.LacerationEffect Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of 1.19.2-epic-knights-fabric Show documentation
Show all versions of 1.19.2-epic-knights-fabric Show documentation
mod that adds medieval stuff to the game
The newest version!
package com.magistuarmory.effects;
import com.magistuarmory.util.CombatHelper;
import net.minecraft.class_1282;
import net.minecraft.class_1291;
import net.minecraft.class_1293;
import net.minecraft.class_1309;
import net.minecraft.class_1322.class_1323;
import net.minecraft.class_1548;
import net.minecraft.class_4081;
import net.minecraft.class_5134;
import net.minecraft.world.entity.ai.attributes.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class LacerationEffect extends class_1291
{
public static LacerationEffect INSTANCE = new LacerationEffect();
public LacerationEffect()
{
super(class_4081.field_18272, -10092544);
method_5566(class_5134.field_23716, "81AEAA56-376B-4498-935B-2F7F68070635", -2.0f, class_1323.field_6328);
}
@Override
public @NotNull String method_5567()
{
return "effect.laceration";
}
@Override
public boolean method_5573()
{
return false;
}
public void method_5572(class_1309 victim, int i)
{
if (victim.method_6032() > victim.method_6063())
victim.method_6033(victim.method_6063());
}
public static void apply(class_1282 source, class_1309 victim, float damage)
{
damage = CombatHelper.getDamageAfterAbsorb(source, victim, damage);
if (victim instanceof class_1548)
return;
if (victim.method_6059(LacerationEffect.INSTANCE))
{
class_1293 effect = victim.method_6112(LacerationEffect.INSTANCE);
int amplifier = effect.method_5578();
int duration = effect.method_5584();
victim.method_6016(LacerationEffect.INSTANCE);
victim.method_6092(new class_1293(LacerationEffect.INSTANCE, Math.max(duration, (int) (damage * 50)), Math.max(amplifier, (int) (0.4 * damage)), true, true, true));
}
else
{
victim.method_6092(new class_1293(LacerationEffect.INSTANCE, (int) (damage * 50), (int) (0.4 * damage), true, true, true));
}
}
}