Skip to content

Commit d391acc

Browse files
committed
some more stuff 4 u :]
1 parent 9b100c1 commit d391acc

File tree

14 files changed

+227
-41
lines changed

14 files changed

+227
-41
lines changed

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ org.gradle.jvmargs=-Xmx1G
33
org.gradle.parallel=true
44

55
# Mod Properties
6-
version=1.0.0-ornithe
6+
version=1.0.0-beta.2
77

88
maven_group=io.github.axolotlclient.oldanimations
99
archives_base_name=AxolotlClient-OldAnimations

src/main/java/io/github/axolotlclient/oldanimations/OldAnimations.java

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -27,25 +27,36 @@
2727

2828
public class OldAnimations implements ClientModInitializer {
2929

30-
/*
31-
TODO LIST
30+
/* TODO LIST
31+
32+
--- Project ---
33+
add readme
34+
update deps (if needed)
35+
36+
--- Sneaking ---
37+
need to verify if other players have a different sneaking position
38+
39+
--- Items ---
3240
blocks item positions (rotations) + fix trapdoors and pressure plates and other crap
41+
rod and bow and block positions and swing position.. can be separate options LOL
42+
43+
--- Textures/Models ---
44+
fix weird fuzzy texture sizes of swords and stuff
45+
fast grass always showns in gui/dropped?
3346
held pressure plates look a bit different?? idk why THEYRE BIGGER THATS WHY
3447
old fence fate model
35-
old fast smooth lighting shadows
36-
tops of certain blocks have switch uvs
48+
oh my god. the custom models/textures are a damn nightmare of a mess
3749
tripwire texture and model changes
3850
cauldrons model and texture
51+
tops of certain blocks have switch uvs
52+
53+
--- World ---
54+
old fast smooth lighting shadows
55+
56+
--- Misc ---
3957
improve fake block mining believability - paneblock and tripwireblock are still not accurate
40-
rod and bow and block positions and swing position.. can be separate options LOL
41-
fix weird fuzzy texture sizes of swords and stuff
42-
fix weird inconsistencies with block item positions between 1.7 and my ported 1.8 code :/
4358
certain mob hitboxes should be visually changed
44-
fast grass always showns in gui/dropped?
45-
is sprint flying different??
46-
need to revamp the sneaking options.. third person sneaking position should be separated from smooth sneaking :p
47-
oh my god. the custom models/textures are a damn nightmare of a mess
48-
need to verify if other players have a different sneaking position
59+
4960
*/
5061

5162
public static final String MODID = "axolotlclient-oldanimations";

src/main/java/io/github/axolotlclient/oldanimations/config/OldAnimationsConfig.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,9 @@ public class OldAnimationsConfig {
117117
public final BooleanOption hitboxOffset = new BooleanOption("hitboxOffset", false);
118118
public final BooleanOption disableGlintOnBlocks = new BooleanOption("disableGlintOnBlocks", false);
119119
public final BooleanOption separateDamageTintFromGlint = new BooleanOption("separateDamageTintFromGlint", false);
120+
public final BooleanOption doubleTapSneak = new BooleanOption("doubleTapSneak", false);
121+
public final BooleanOption rotationVecYawFix = new BooleanOption("rotationVecYawFix", true);
122+
public final BooleanOption framedItemLighting = new BooleanOption("framedItemLighting", true);
120123

121124
private final Supplier<Boolean>[] suppliers = new Supplier[] {
122125
enabled::get,
@@ -171,7 +174,8 @@ public void initConfig() {
171174
stopLineTranslateSneak,
172175
equipLogic,
173176
disableResourcePackItemTransformations,
174-
fixThirdPersonHeldItemSneakDeSync
177+
fixThirdPersonHeldItemSneakDeSync,
178+
framedItemLighting
175179
);
176180
category.add(categoryResources);
177181
categoryResources.add(
@@ -232,11 +236,13 @@ public void initConfig() {
232236
);
233237
category.add(categoryMisc);
234238
categoryMisc.add(
239+
doubleTapSneak,
235240
disableAlexModel,
236241
disableSkinLayers,
237242
flameOffset,
238243
oldPickupArm,
239244
fixCameraPitch,
245+
rotationVecYawFix,
240246
xpOrbPosition,
241247
oldFogGrayScale,
242248
removeHitBoxEyeLines,

src/main/java/io/github/axolotlclient/oldanimations/mixin/CapeLayerMixin.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
@Mixin(CapeLayer.class)
3333
public class CapeLayerMixin {
3434

35-
@Dynamic("OptiFine")
36-
@WrapWithCondition(method = "render(Lnet/minecraft/client/entity/living/player/ClientPlayerEntity;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;translatef(FFF)V", ordinal = 1))
35+
@Dynamic("Translation added by OptiFine")
36+
@WrapWithCondition(method = "render(Lnet/minecraft/client/entity/living/player/ClientPlayerEntity;FFFFFFF)V", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;translatef(FFF)V", ordinal = 1), require = 0)
3737
private boolean axolotlclient$disableOptiFineTranslation(float f, float g, float h) {
3838
/* optifine attemps to fix 1.8's weird cape position... that's all well and good, but let's just disable that when we use our own :p */
3939
return !OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.thirdPersonSneaking.get();
4040
}
4141

42-
@Dynamic("OptiFine")
43-
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/entity/living/player/ClientPlayerEntity;FFFFFFF)V", at = @At(value = "CONSTANT", args = "floatValue=165.0"))
42+
@Dynamic("Clamping value added by OptiFine")
43+
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/entity/living/player/ClientPlayerEntity;FFFFFFF)V", at = @At(value = "CONSTANT", args = "floatValue=165.0"), require = 0)
4444
private float axolotlclient$disableOptiFineClamp(float original) {
4545
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get()) {
4646
/* optifine attemps to clamp the cape's physics... nuh uh */
@@ -49,8 +49,8 @@ public class CapeLayerMixin {
4949
return original;
5050
}
5151

52-
@Dynamic("OptiFine")
53-
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/entity/living/player/ClientPlayerEntity;FFFFFFF)V", at = @At(value = "CONSTANT", args = "floatValue=-5.0"))
52+
@Dynamic("Clamping value added by OptiFine")
53+
@ModifyExpressionValue(method = "render(Lnet/minecraft/client/entity/living/player/ClientPlayerEntity;FFFFFFF)V", at = @At(value = "CONSTANT", args = "floatValue=-5.0"), require = 0)
5454
private float axolotlclient$disableOptiFineClamp2(float original) {
5555
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get()) {
5656
/* optifine attemps to clamp the cape's physics... nuh uh */

src/main/java/io/github/axolotlclient/oldanimations/mixin/HeldItemRendererMixin.java

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,12 @@
2020

2121
import com.llamalad7.mixinextras.expression.Expression;
2222
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
23+
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
24+
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2325
import com.llamalad7.mixinextras.sugar.Local;
2426
import com.mojang.blaze3d.platform.GlStateManager;
2527
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
2628
import io.github.axolotlclient.oldanimations.util.ItemUtil;
27-
import net.minecraft.client.entity.living.player.ClientPlayerEntity;
2829
import net.minecraft.client.render.HeldItemRenderer;
2930
import net.minecraft.client.render.item.ItemRenderer;
3031
import net.minecraft.client.render.model.block.ModelTransformations;
@@ -76,19 +77,16 @@ public abstract class HeldItemRendererMixin {
7677
axolotlclient$h = null; /* big brain time */
7778
}
7879

79-
@Inject(method = "applyBowNocking", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;scalef(FFF)V"))
80-
private void axolotlclient$preBowTransform(float f, ClientPlayerEntity clientPlayerEntity, CallbackInfo ci) {
81-
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.oldBowRotation.get()) {
82-
/* original transformations from 1.7 */
80+
@WrapOperation(method = "applyBowNocking", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;scalef(FFF)V"))
81+
private void axolotlclient$applyBowTransform(float f, float g, float h, Operation<Void> original) {
82+
boolean isEnabled = OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.oldBowRotation.get();
83+
/* original transformations from 1.7 */
84+
if (isEnabled) {
8385
GlStateManager.rotatef(-335.0F, 0.0F, 0.0F, 1.0F);
8486
GlStateManager.rotatef(-50.0F, 0.0F, 1.0F, 0.0F);
8587
}
86-
}
87-
88-
@Inject(method = "applyBowNocking", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;scalef(FFF)V", shift = At.Shift.AFTER))
89-
private void axolotlclient$postBowTransform(float f, ClientPlayerEntity abstractClientPlayerEntity, CallbackInfo ci) {
90-
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.oldBowRotation.get()) {
91-
/* original transformations from 1.7 */
88+
original.call(f, g, h);
89+
if (isEnabled) {
9290
GlStateManager.rotatef(50.0F, 0.0F, 1.0F, 0.0F);
9391
GlStateManager.rotatef(335.0F, 0.0F, 0.0F, 1.0F);
9492
}
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
/*
2+
* This program is free software; you can redistribute it and/or
3+
* modify it under the terms of the GNU Lesser General Public
4+
* License as published by the Free Software Foundation; either
5+
* version 3 of the License, or (at your option) any later version.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10+
* Lesser General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU Lesser General Public License
13+
* along with this program; if not, write to the Free Software Foundation,
14+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15+
*
16+
* For more information, see the LICENSE file.
17+
*/
18+
19+
package io.github.axolotlclient.oldanimations.mixin;
20+
21+
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
22+
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
23+
import net.minecraft.client.render.entity.ItemFrameRenderer;
24+
import org.spongepowered.asm.mixin.Mixin;
25+
import org.spongepowered.asm.mixin.injection.At;
26+
27+
@Mixin(ItemFrameRenderer.class)
28+
public class ItemFrameRendererMixin {
29+
30+
/* wow */
31+
32+
@WrapWithCondition(method = "renderItem", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;disableLighting()V"))
33+
private boolean axolotlclient$allowLighting() {
34+
/* taken from 1.7 */
35+
return !OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.framedItemLighting.get();
36+
}
37+
38+
@WrapWithCondition(method = "renderItem", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;pushLightingAttributes()V"))
39+
private boolean axolotlclient$allowLighting2() {
40+
/* taken from 1.7 */
41+
return !OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.framedItemLighting.get();
42+
}
43+
44+
@WrapWithCondition(method = "renderItem", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/Lighting;turnOff()V"))
45+
private boolean axolotlclient$allowLighting3() {
46+
/* taken from 1.7 */
47+
return !OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.framedItemLighting.get();
48+
}
49+
50+
@WrapWithCondition(method = "renderItem", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/Lighting;turnOn()V"))
51+
private boolean axolotlclient$allowLighting4() {
52+
/* taken from 1.7 */
53+
return !OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.framedItemLighting.get();
54+
}
55+
56+
@WrapWithCondition(method = "renderItem", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;popAttributes()V"))
57+
private boolean axolotlclient$allowLighting5() {
58+
/* taken from 1.7 */
59+
return !OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.framedItemLighting.get();
60+
}
61+
62+
@WrapWithCondition(method = "renderItem", at = @At(value = "INVOKE", target = "Lcom/mojang/blaze3d/platform/GlStateManager;enableLighting()V"))
63+
private boolean axolotlclient$allowLighting6() {
64+
/* taken from 1.7 */
65+
return !OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.framedItemLighting.get();
66+
}
67+
}

src/main/java/io/github/axolotlclient/oldanimations/mixin/ItemRendererMixin.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
package io.github.axolotlclient.oldanimations.mixin;
2020

2121
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
22+
import com.llamalad7.mixinextras.injector.v2.WrapWithCondition;
2223
import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
2324
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
2425
import com.llamalad7.mixinextras.sugar.Local;
@@ -128,11 +129,9 @@ public abstract class ItemRendererMixin {
128129
return OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.oldGlintColor.get() ? -10407781 : color;
129130
}
130131

131-
@WrapOperation(method = "renderItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/ItemRenderer;renderEnchantmentGlint(Lnet/minecraft/client/resource/model/BakedModel;)V"))
132-
public void axolotlclient$disableBlocksGlint(ItemRenderer instance, BakedModel bakedModel, Operation<Void> original, @Local(argsOnly = true) ItemStack itemStack) {
133-
if (!OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.disableGlintOnBlocks.get() || !isGui3d(itemStack)) {
134-
original.call(instance, bakedModel);
135-
}
132+
@WrapWithCondition(method = "renderItem", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/item/ItemRenderer;renderEnchantmentGlint(Lnet/minecraft/client/resource/model/BakedModel;)V"))
133+
private boolean axolotlclient$disableBlocksGlint(ItemRenderer instance, BakedModel bakedModel, @Local(argsOnly = true) ItemStack itemStack) {
134+
return !OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.disableGlintOnBlocks.get() || !isGui3d(itemStack);
136135
}
137136

138137
@Inject(method = "renderEnchantmentGlint", at = @At("HEAD"), cancellable = true)
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*
2+
* This program is free software; you can redistribute it and/or
3+
* modify it under the terms of the GNU Lesser General Public
4+
* License as published by the Free Software Foundation; either
5+
* version 3 of the License, or (at your option) any later version.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10+
* Lesser General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU Lesser General Public License
13+
* along with this program; if not, write to the Free Software Foundation,
14+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15+
*
16+
* For more information, see the LICENSE file.
17+
*/
18+
19+
package io.github.axolotlclient.oldanimations.mixin;
20+
21+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
22+
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
23+
import net.minecraft.entity.Entity;
24+
import net.minecraft.entity.living.LivingEntity;
25+
import net.minecraft.world.World;
26+
import org.objectweb.asm.Opcodes;
27+
import org.spongepowered.asm.mixin.Mixin;
28+
import org.spongepowered.asm.mixin.injection.At;
29+
30+
@Mixin(LivingEntity.class)
31+
public abstract class LivingEntityMixin extends Entity {
32+
33+
public LivingEntityMixin(World world) {
34+
super(world);
35+
}
36+
37+
/* NOTE: the following two injections already exist in optifine, however, for people not using it, */
38+
/* i think it would be preferred to add an option in this mod seeing as it's relevant to 1.7 */
39+
40+
@ModifyExpressionValue(method = "getRotationVec", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/living/LivingEntity;prevHeadYaw:F"))
41+
private float axolotlclient$usePrevYaw(float original) {
42+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.rotationVecYawFix.get()) {
43+
/* don't use the prev head yaw as it is not accurate compared to prev yaw */
44+
original = prevYaw;
45+
}
46+
return original;
47+
}
48+
49+
@ModifyExpressionValue(method = "getRotationVec", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/living/LivingEntity;headYaw:F"))
50+
private float axolotlclient$useYaw(float original) {
51+
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.rotationVecYawFix.get()) {
52+
/* ditto but with yaw */
53+
original = yaw;
54+
}
55+
return original;
56+
}
57+
}
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
/*
2+
* This program is free software; you can redistribute it and/or
3+
* modify it under the terms of the GNU Lesser General Public
4+
* License as published by the Free Software Foundation; either
5+
* version 3 of the License, or (at your option) any later version.
6+
*
7+
* This program is distributed in the hope that it will be useful,
8+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
9+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
10+
* Lesser General Public License for more details.
11+
*
12+
* You should have received a copy of the GNU Lesser General Public License
13+
* along with this program; if not, write to the Free Software Foundation,
14+
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
15+
*
16+
* For more information, see the LICENSE file.
17+
*/
18+
19+
package io.github.axolotlclient.oldanimations.mixin;
20+
21+
import com.llamalad7.mixinextras.injector.ModifyExpressionValue;
22+
import io.github.axolotlclient.oldanimations.config.OldAnimationsConfig;
23+
import net.minecraft.client.entity.living.player.LocalClientPlayerEntity;
24+
import org.objectweb.asm.Opcodes;
25+
import org.spongepowered.asm.mixin.Mixin;
26+
import org.spongepowered.asm.mixin.injection.At;
27+
28+
@Mixin(LocalClientPlayerEntity.class)
29+
public class LocalClientPlayerEntityMixin {
30+
31+
@ModifyExpressionValue(method = "tickAi", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/client/player/input/PlayerInput;sneaking:Z", ordinal = 0))
32+
private boolean axolotlclient$allowSneakingToStartSprinting(boolean original) {
33+
/* this check simply doesn't exist in 1.7 which allows you to basically double tap your sneaking key to sprint lol */
34+
return (!OldAnimationsConfig.isEnabled() || !OldAnimationsConfig.instance.doubleTapSneak.get()) && original;
35+
}
36+
}

src/main/java/io/github/axolotlclient/oldanimations/mixin/PlayerEntityMixin.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public PlayerEntityMixin(World world) {
3737
@ModifyExpressionValue(method = "tick", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/living/player/PlayerEntity;y:D", ordinal = 0))
3838
private double axolotlclient$includeEyeHeight$Y(double original) {
3939
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get()) {
40-
/* sneaking moves the eyeheight down by 0.08 units... we must also make sure this applies to other renderings */
40+
/* sneaking moves the eyeheight down by 0.08 units... we must also make sure this applies to cape physics! */
4141
original += isSneaking() ? -0.08F : 0.0F;
4242
}
4343
return original;
@@ -46,7 +46,7 @@ public PlayerEntityMixin(World world) {
4646
@ModifyExpressionValue(method = "tick", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/living/player/PlayerEntity;y:D", ordinal = 1))
4747
private double axolotlclient$includeEyeHeight$Y2(double original) {
4848
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get()) {
49-
/* sneaking moves the eyeheight down by 0.08 units... we must also make sure this applies to other renderings */
49+
/* sneaking moves the eyeheight down by 0.08 units... we must also make sure this applies to cape physics! */
5050
original += isSneaking() ? -0.08F : 0.0F;
5151
}
5252
return original;
@@ -55,7 +55,7 @@ public PlayerEntityMixin(World world) {
5555
@ModifyExpressionValue(method = "tick", at = @At(value = "FIELD", opcode = Opcodes.GETFIELD, target = "Lnet/minecraft/entity/living/player/PlayerEntity;y:D", ordinal = 2))
5656
private double axolotlclient$includeEyeHeight$Y3(double original) {
5757
if (OldAnimationsConfig.isEnabled() && OldAnimationsConfig.instance.thirdPersonSneaking.get()) {
58-
/* sneaking moves the eyeheight down by 0.08 units... we must also make sure this applies to other renderings */
58+
/* sneaking moves the eyeheight down by 0.08 units... we must also make sure this applies to cape physics! */
5959
original += isSneaking() ? -0.08F : 0.0F;
6060
}
6161
return original;

0 commit comments

Comments
 (0)