Skip to content

Commit

Permalink
player render
Browse files Browse the repository at this point in the history
Signed-off-by: wefcdse <3371348169@qq.com>
  • Loading branch information
wefcdse committed Nov 8, 2024
1 parent 04d01e8 commit feda0f4
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ public static class AngularVelocity_DegSec {
public float slow_motion_time_rate = 0.2f;
public String slow_motion_switch_name = "sm";

public boolean disable_player_render_when_flying = true;


/////////////////////////////////
public float getCamera_angle() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.iung.fpv20.mixin.client;

import com.iung.fpv20.Fpv20Client;
import com.iung.fpv20.flying.GlobalFlying;
import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.network.AbstractClientPlayerEntity;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.PlayerEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
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(PlayerEntityRenderer.class)
public class PlayerEntityRendererMixin {
@Inject(
method = "render*",
at = @At("HEAD"), cancellable = true
)
public void mixin0(AbstractClientPlayerEntity abstractClientPlayerEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i, CallbackInfo ci) {
if(GlobalFlying.getFlying() && Fpv20Client.config1.disable_player_render_when_flying){
ci.cancel();
}
}
}
3 changes: 2 additions & 1 deletion src/client/resources/fpv20.client.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"CameraMixin",
"GameRendererMixin",
"Hud",
"OptionEntryBtn"
"OptionEntryBtn",
"PlayerEntityRendererMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit feda0f4

Please sign in to comment.