-
Notifications
You must be signed in to change notification settings - Fork 26
Expand file tree
/
Copy pathEntityMixin.java
More file actions
48 lines (40 loc) · 1.38 KB
/
EntityMixin.java
File metadata and controls
48 lines (40 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
43
44
45
46
47
48
package net.modificationstation.sltest.mixin;
import net.minecraft.entity.Entity;
import net.modificationstation.sltest.celestial.CelestialListener;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
@Mixin(Entity.class)
public class EntityMixin {
@Shadow public float yaw;
@Shadow public float pitch;
@Shadow public double velocityY;
@Shadow public double velocityX;
@Shadow public double velocityZ;
@Inject(
method = "tick",
at = @At("HEAD")
)
public void spinEntity(CallbackInfo ci) {
if (CelestialListener.spinningDimando.isActive()) {
this.yaw = (this.yaw + 0.1F) % 360.0F;
this.pitch = (this.pitch + 0.1F) % 360.0F;
}
if (CelestialListener.flyingDimando.isActive()) {
if (this.velocityY < 0.5F) {
this.velocityY += 0.05F;
}
}
if (CelestialListener.fallingDimando.isActive()) {
if (this.velocityY > -0.1F) {
this.velocityY -= 0.05F;
}
}
if (CelestialListener.longDimando.isActive()) {
this.velocityX *= 1.1F;
this.velocityZ *= 1.1F;
}
}
}