-
Notifications
You must be signed in to change notification settings - Fork 308
Expand file tree
/
Copy pathMixinLivingEntity.java
More file actions
42 lines (35 loc) · 1.38 KB
/
MixinLivingEntity.java
File metadata and controls
42 lines (35 loc) · 1.38 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
package wayoftime.bloodmagic.mixin.client;
import com.llamalad7.mixinextras.injector.ModifyReturnValue;
import net.minecraft.client.Minecraft;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.LivingEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.level.Level;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import wayoftime.bloodmagic.potion.BloodMagicPotions;
@Mixin(LivingEntity.class)
public abstract class MixinLivingEntity extends Entity
{
public MixinLivingEntity(EntityType<?> p_19870_, Level p_19871_) {
super(p_19870_, p_19871_);
throw new IllegalStateException("Instantiated MixinLivingEntity");
}
@ModifyReturnValue(
method = "isCurrentlyGlowing",
at = @At(value = "RETURN")
)
public boolean isCurrentlyGlowing(boolean original){
Player player = Minecraft.getInstance().player;
if(player != null && player.hasEffect(BloodMagicPotions.SPECTRAL_SIGHT.get()))
{
double distance = (player.getEffect(BloodMagicPotions.SPECTRAL_SIGHT.get()).getAmplifier() * 32 + 24);
if (distanceToSqr(Minecraft.getInstance().player) <= (distance * distance))
{
return true;
}
}
return original;
}
}