Skip to content

Commit

Permalink
worlds greatest animations
Browse files Browse the repository at this point in the history
  • Loading branch information
finxx authored and finxx committed Dec 26, 2024
1 parent e348f5f commit ee439d2
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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();
}
}
Expand Down

0 comments on commit ee439d2

Please sign in to comment.