Skip to content

Commit

Permalink
re-write part 2 (only slight update)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Sep 3, 2024
1 parent 64fc89f commit 906ac03
Show file tree
Hide file tree
Showing 10 changed files with 189 additions and 40 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ public class OldAnimations implements ClientModInitializer {
public final BooleanOption rod = new BooleanOption("rod", true);
public final BooleanOption armourDamage = new BooleanOption("armorDamage", true);
public final BooleanOption sneaking = new BooleanOption("sneaking", true);
public final BooleanOption heartFlashing = new BooleanOption("heartFlashing", true);
public final BooleanOption debugOverlay = new BooleanOption("debugOverlay", true);

public static final String MODID = "axolotlclient-oldanimations";
Expand All @@ -71,6 +72,7 @@ public OldAnimations() {
rod,
armourDamage,
sneaking,
heartFlashing,
debugOverlay
);
AXOLOTLCLIENT = FabricLoader.getInstance().isModLoaded("axolotlclient");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,9 @@

package io.github.axolotlclient.oldanimations;

import java.util.function.Function;

import io.github.axolotlclient.AxolotlClientConfig.AxolotlClientConfigManager;
import io.github.prospector.modmenu.api.ConfigScreenFactory;
import io.github.prospector.modmenu.api.ModMenuApi;
import net.minecraft.client.gui.screen.Screen;

public class OldAnimationsModmenu implements ModMenuApi {

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.oldanimations.mixin;

import net.minecraft.client.render.entity.model.BiPedModel;
Expand All @@ -18,26 +36,10 @@ public abstract class BiPedModelMixin {
public ModelPart rightArm;

@Inject(
method = "setAngles",
at = @At(
value = "FIELD",
opcode = Opcodes.PUTFIELD,
target = "Lnet/minecraft/client/render/model/ModelPart;posY:F",
shift = At.Shift.AFTER
),
method = "setAngles", at = @At(value = "FIELD", opcode = Opcodes.PUTFIELD, target = "Lnet/minecraft/client/render/model/ModelPart;posY:F", shift = At.Shift.AFTER),
slice = @Slice(
from = @At(
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/client/render/entity/model/BiPedModel;rightArmPose:I",
ordinal = 0
),
to = @At(
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/client/render/entity/model/BiPedModel;rightArmPose:I",
ordinal = 2
)
from = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/render/entity/model/BiPedModel;rightArmPose:I", ordinal = 0),
to = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/render/entity/model/BiPedModel;rightArmPose:I", ordinal = 2)
)
)
private void axolotlclient$oldArmPosition(float limbSwing, float limbSwingAmount, float ageInTicks, float netHeadYaw, float headPitch, float scaleFactor, Entity entityIn, CallbackInfo ci) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.oldanimations.mixin;

import io.github.axolotlclient.oldanimations.OldAnimations;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.oldanimations.mixin;

import com.mojang.blaze3d.platform.GlStateManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.oldanimations.mixin;

import io.github.axolotlclient.oldanimations.OldAnimations;
import net.minecraft.client.gui.hud.InGameHud;
import net.minecraft.client.util.Window;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Unique;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.ModifyArg;
import org.spongepowered.asm.mixin.injection.ModifyVariable;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(InGameHud.class)
public abstract class InGameHudMixin {

//todo: find a better way to do this :p
@Unique
private boolean bl;

@ModifyVariable(
method = "renderStatusBars",
at = @At(
value = "STORE",
ordinal = 0
),
index = 4
)
private boolean axolotlclient$disableFlashingCheck(boolean value) {
bl = value; /* heart flashing local*/
return false;
}

@ModifyArg(
method = "renderStatusBars",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/gui/hud/InGameHud;drawTexture(IIIIII)V",
ordinal = 3
),
index = 2
)
private int axolotlclient$enableFlashingCheck(int par1) {
return par1 + (isHeartFlashingEnabled() && bl ? 1 : 0) * 9;
}

@Inject(method = "renderStatusBars", at = @At("TAIL"))
private void axolotlclient$releaseCapturedLocal(Window window, CallbackInfo ci) {
bl = false; /* big brain time */
}

@Unique
private static boolean isHeartFlashingEnabled() {
return OldAnimations.getInstance().enabled.get() && OldAnimations.getInstance().heartFlashing.get();
}
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.oldanimations.mixin;

import com.mojang.blaze3d.platform.GlStateManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,21 @@
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 3 of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program; if not, write to the Free Software Foundation,
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* For more information, see the LICENSE file.
*/

package io.github.axolotlclient.oldanimations.utils;

import net.minecraft.item.BannerItem;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ bow=Bow
rod=Rod
armorDamage=Armour Damage
sneaking=Sneaking
heartFlashing=Heart Flashing
debugOverlay=Debug Overlay
37 changes: 19 additions & 18 deletions src/main/resources/oldanimations.mixins.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
{
"required": true,
"package": "io.github.axolotlclient.oldanimations.mixin",
"compatibilityLevel": "JAVA_8",
"client": [
"ArmorFeatureRendererMixin",
"BiPedModelMixin",
"DebugHudMixin",
"FishingBobberEntityRendererMixin",
"GameRendererMixin",
"HeldItemRendererMixin",
"ItemRendererMixin",
"LivingEntityAccessor",
"LivingEntityRendererMixin",
"MinecraftClientAccessor",
"MinecraftClientMixin"
],
"injectors": {
"defaultRequire": 1
"required": true,
"package": "io.github.axolotlclient.oldanimations.mixin",
"compatibilityLevel": "JAVA_8",
"client": [
"ArmorFeatureRendererMixin",
"BiPedModelMixin",
"DebugHudMixin",
"FishingBobberEntityRendererMixin",
"GameRendererMixin",
"HeldItemRendererMixin",
"InGameHudMixin",
"ItemRendererMixin",
"LivingEntityAccessor",
"LivingEntityRendererMixin",
"MinecraftClientAccessor",
"MinecraftClientMixin"
],
"injectors": {
"defaultRequire": 1
}
}

0 comments on commit 906ac03

Please sign in to comment.