|
| 1 | +/** |
| 2 | + * Animatium |
| 3 | + * The all-you-could-want legacy animations mod for modern minecraft versions. |
| 4 | + * Brings back animations from the 1.7/1.8 era and more. |
| 5 | + * <p> |
| 6 | + * Copyright (C) 2024-2025 lowercasebtw |
| 7 | + * Copyright (C) 2024-2025 mixces |
| 8 | + * Copyright (C) 2024-2025 Contributors to the project retain their copyright |
| 9 | + * <p> |
| 10 | + * This program is free software: you can redistribute it and/or modify |
| 11 | + * it under the terms of the GNU General Public License as published by |
| 12 | + * the Free Software Foundation, either version 3 of the License, or |
| 13 | + * (at your option) any later version. |
| 14 | + * <p> |
| 15 | + * This program is distributed in the hope that it will be useful, |
| 16 | + * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | + * GNU General Public License for more details. |
| 19 | + * <p> |
| 20 | + * You should have received a copy of the GNU General Public License |
| 21 | + * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | + * <p> |
| 23 | + * "MINECRAFT" LINKING EXCEPTION TO THE GPL |
| 24 | + */ |
| 25 | + |
| 26 | +package org.visuals.legacy.animatium.mixins.v1.entity.cape_movement; |
| 27 | + |
| 28 | +import com.mojang.blaze3d.vertex.VertexConsumer; |
| 29 | +import net.minecraft.client.model.PlayerCapeModel; |
| 30 | +import net.minecraft.client.renderer.MultiBufferSource; |
| 31 | +import net.minecraft.client.renderer.OutlineBufferSource; |
| 32 | +import net.minecraft.client.renderer.RenderType; |
| 33 | +import net.minecraft.client.renderer.SubmitNodeStorage; |
| 34 | +import net.minecraft.client.renderer.feature.ModelFeatureRenderer; |
| 35 | +import org.spongepowered.asm.mixin.Mixin; |
| 36 | +import org.spongepowered.asm.mixin.injection.At; |
| 37 | +import org.spongepowered.asm.mixin.injection.Inject; |
| 38 | +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; |
| 39 | +import org.visuals.legacy.animatium.Animatium; |
| 40 | +import org.visuals.legacy.animatium.config.AnimatiumConfig; |
| 41 | + |
| 42 | +@Mixin(ModelFeatureRenderer.class) |
| 43 | +public abstract class MixinModelFeatureRenderer_CapeSwinging { |
| 44 | + @Inject(method = "renderModel", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/Model;setupAnim(Ljava/lang/Object;)V", shift = At.Shift.AFTER)) |
| 45 | + private <S> void animatium$capeSwingRotation(final SubmitNodeStorage.ModelSubmit<S> submit, final RenderType renderType, final VertexConsumer consumer, final OutlineBufferSource outlineBufferSource, final MultiBufferSource.BufferSource crumblingBufferSource, final CallbackInfo ci) { |
| 46 | + if (Animatium.isEnabled() && !AnimatiumConfig.instance().movement.capeSwingRotation && submit.model() instanceof PlayerCapeModel playerCapeModel) { |
| 47 | + playerCapeModel.body.yRot = 0; |
| 48 | + } |
| 49 | + } |
| 50 | +} |
0 commit comments