diff --git a/src/client/java/com/nuclearcrackhead/serverboss/mixin/client/HeldItemRendererMixin.java b/src/client/java/com/nuclearcrackhead/serverboss/mixin/client/HeldItemRendererMixin.java index 4fe7e75..d05ab83 100644 --- a/src/client/java/com/nuclearcrackhead/serverboss/mixin/client/HeldItemRendererMixin.java +++ b/src/client/java/com/nuclearcrackhead/serverboss/mixin/client/HeldItemRendererMixin.java @@ -7,6 +7,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.client.network.AbstractClientPlayerEntity; import net.minecraft.util.Hand; +import net.minecraft.client.render.item.ItemRenderer; +import net.minecraft.item.ModelTransformationMode; +import net.minecraft.client.render.OverlayTexture; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; @@ -21,10 +24,16 @@ @Mixin(HeldItemRenderer.class) public class HeldItemRendererMixin { + @Shadow ItemRenderer itemRenderer; + @Inject(at = @At("HEAD"), method = "renderFirstPersonItem", cancellable = true) private void renderGun(AbstractClientPlayerEntity player, float tickDelta, float pitch, Hand hand, float swingProgress, ItemStack item, float equipProgress, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) { if (item.getItem() instanceof IGun gun) { - // todo render + matrices.push(); + matrices.translate(0.5, -0.5, -0.5); + matrices.translate(0, swingProgress, 0); + itemRenderer.renderItem(player, item, ModelTransformationMode.FIRST_PERSON_RIGHT_HAND, false, matrices, vertexConsumers, player.getWorld(), light, OverlayTexture.DEFAULT_UV, 2); + matrices.pop(); ci.cancel(); } }