use of dev.hypnotic.event.events.EventRenderItem 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();
}
use of dev.hypnotic.event.events.EventRenderItem in project Hypnotic-Client by Hypnotic-Development.
the class ItemRendererMixin method postRenderItem.
@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("RETURN"), cancellable = true)
public void postRenderItem(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.POST, leftHanded);
event.call();
if (event.isCancelled())
ci.cancel();
}
Aggregations