Search in sources :

Example 1 with ArmCustomize

use of dev.hypnotic.module.render.ArmCustomize in project Hypnotic-Client by Hypnotic-Development.

the class ItemRendererMixin method preRenderItem.

@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", at = @At("HEAD"), cancellable = true)
public void preRenderItem(ItemStack stack, ModelTransformation.Mode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, CallbackInfo ci) {
    EventRenderItem event = new EventRenderItem(matrices, stack, renderMode, EventRenderItem.RenderTime.PRE, leftHanded);
    event.call();
    if (ModuleManager.INSTANCE.getModule(OldBlock.class).isEnabled()) {
        if ((ModuleManager.INSTANCE.getModule(Killaura.class).autoBlockMode.is("Visual") && Killaura.target != null ? Killaura.target == null : !mc.player.isUsingItem()) || renderMode != ModelTransformation.Mode.FIRST_PERSON_RIGHT_HAND)
            return;
        MatrixStack matrixStack = event.getMatrixStack();
        boolean offHand = event.isLeftHanded() ? event.getType() == ModelTransformation.Mode.FIRST_PERSON_RIGHT_HAND : event.getType() == ModelTransformation.Mode.FIRST_PERSON_LEFT_HAND;
        if (!offHand) {
            if ((event.getItemStack().getItem() instanceof AxeItem || event.getItemStack().getItem() instanceof SwordItem) && event.getItemStack() == mc.player.getMainHandStack()) {
                matrixStack.multiply(new Quaternion(-270f, 0f, 270f, true));
                matrixStack.multiply(new Quaternion(-120f, 270f, -150f, true));
                matrixStack.multiply(new Quaternion(-70f, -108f, 90f, true));
                // Only plays with killaura
                if (Killaura.target != null && !Killaura.target.isDead()) {
                    switch(ModuleManager.INSTANCE.getModule(OldBlock.class).animation.getSelected()) {
                        case "1.7(ish)":
                            matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, 0, 0, true));
                            break;
                        case "Slide":
                            matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks / 2, true));
                            break;
                        case "Sigma":
                            matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks * 0.15f, 0, 0, true));
                            matrixStack.multiply(new Quaternion(0, 0, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks * 0.5f, true));
                            break;
                        case "Swing":
                            mc.player.swingHand(Hand.MAIN_HAND);
                            break;
                    }
                }
                ArmCustomize arm = ModuleManager.INSTANCE.getModule(ArmCustomize.class);
                if (arm.isEnabled())
                    matrixStack.translate(arm.mainX.getValue(), arm.mainY.getValue(), arm.mainZ.getValue());
            }
        }
    }
    if (event.isCancelled())
        ci.cancel();
}
Also used : OldBlock(dev.hypnotic.module.render.OldBlock) Quaternion(net.minecraft.util.math.Quaternion) MatrixStack(net.minecraft.client.util.math.MatrixStack) EventRenderItem(dev.hypnotic.event.events.EventRenderItem) SwordItem(net.minecraft.item.SwordItem) AxeItem(net.minecraft.item.AxeItem) ArmCustomize(dev.hypnotic.module.render.ArmCustomize) Inject(org.spongepowered.asm.mixin.injection.Inject)

Aggregations

EventRenderItem (dev.hypnotic.event.events.EventRenderItem)1 ArmCustomize (dev.hypnotic.module.render.ArmCustomize)1 OldBlock (dev.hypnotic.module.render.OldBlock)1 MatrixStack (net.minecraft.client.util.math.MatrixStack)1 AxeItem (net.minecraft.item.AxeItem)1 SwordItem (net.minecraft.item.SwordItem)1 Quaternion (net.minecraft.util.math.Quaternion)1 Inject (org.spongepowered.asm.mixin.injection.Inject)1