-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make mod activate with other entities too (it broken now)
- Loading branch information
1 parent
4855679
commit 0edb2a7
Showing
8 changed files
with
121 additions
and
138 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 0 additions & 81 deletions
81
...va/net/derfruhling/minecraft/create/trainperspective/mixin/AbstractClientPlayerMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...va/net/derfruhling/minecraft/create/trainperspective/mixin/LivingEntityRendererMixin.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package net.derfruhling.minecraft.create.trainperspective.mixin; | ||
|
||
import com.mojang.blaze3d.vertex.PoseStack; | ||
import com.mojang.math.Axis; | ||
import net.derfruhling.minecraft.create.trainperspective.Conditional; | ||
import net.derfruhling.minecraft.create.trainperspective.Perspective; | ||
import net.fabricmc.api.EnvType; | ||
import net.fabricmc.api.Environment; | ||
import net.minecraft.client.player.AbstractClientPlayer; | ||
import net.minecraft.client.renderer.entity.LivingEntityRenderer; | ||
import net.minecraft.client.renderer.entity.player.PlayerRenderer; | ||
import net.minecraft.util.Mth; | ||
import net.minecraft.world.entity.LivingEntity; | ||
import org.spongepowered.asm.mixin.Implements; | ||
import org.spongepowered.asm.mixin.Interface; | ||
import org.spongepowered.asm.mixin.Mixin; | ||
import org.spongepowered.asm.mixin.injection.At; | ||
import org.spongepowered.asm.mixin.injection.Inject; | ||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; | ||
|
||
@Mixin(LivingEntityRenderer.class) | ||
@Environment(EnvType.CLIENT) | ||
public class LivingEntityRendererMixin { | ||
@Inject(method = "setupRotations", at = @At("HEAD")) | ||
protected void setupRotations(LivingEntity livingEntity, PoseStack poseStack, float f, float g, float h, CallbackInfo ci) { | ||
if(Conditional.shouldApplyPerspectiveTo(livingEntity)) { | ||
Perspective persp = (Perspective) livingEntity; | ||
float height = 0; | ||
|
||
if(livingEntity.getVehicle() != null) { | ||
height = livingEntity.getEyeHeight(); | ||
} | ||
|
||
var lean = persp.getLean(f); | ||
var yaw = persp.getYaw(f); | ||
poseStack.rotateAround(Axis.ZP.rotationDegrees(Mth.cos(Mth.DEG_TO_RAD * yaw) * lean), 0, height, 0); | ||
poseStack.rotateAround(Axis.XP.rotationDegrees(Mth.sin(Mth.DEG_TO_RAD * yaw) * -lean), 0, height, 0); | ||
} | ||
} | ||
} |
48 changes: 0 additions & 48 deletions
48
...ain/java/net/derfruhling/minecraft/create/trainperspective/mixin/PlayerRendererMixin.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters