29 lines
1.2 KiB
Java
29 lines
1.2 KiB
Java
package com.atsuishio.superbwarfare.mixins;
|
|
|
|
import com.mojang.blaze3d.vertex.PoseStack;
|
|
import com.atsuishio.superbwarfare.init.ModTags;
|
|
import net.minecraft.client.CameraType;
|
|
import net.minecraft.client.Minecraft;
|
|
import net.minecraft.client.renderer.GameRenderer;
|
|
import net.minecraft.world.entity.player.Player;
|
|
import net.minecraft.world.item.ItemStack;
|
|
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(GameRenderer.class)
|
|
public class GameRendererMixin {
|
|
|
|
@Inject(method = "bobView(Lcom/mojang/blaze3d/vertex/PoseStack;F)V", at = @At("HEAD"), cancellable = true)
|
|
public void bobView(PoseStack p_109139_, float p_109140_, CallbackInfo ci) {
|
|
Minecraft mc = Minecraft.getInstance();
|
|
Player player = mc.player;
|
|
if (player != null) {
|
|
ItemStack stack = player.getMainHandItem();
|
|
if (stack.is(ModTags.Items.GUN) && Minecraft.getInstance().options.getCameraType() == CameraType.FIRST_PERSON) {
|
|
ci.cancel();
|
|
}
|
|
}
|
|
}
|
|
}
|