Skip to content

Commit

Permalink
old projectiles too 🙏
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Feb 29, 2024
1 parent bcb387e commit 91a6d41
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ public class LegacyAnimationsSettings {
public boolean oldDebug = true;
@SerialEntry
public boolean perspectiveCrosshair = true;
@SerialEntry
public boolean oldProjectiles = true;


@SuppressWarnings("deprecation")
Expand Down Expand Up @@ -132,6 +134,12 @@ public static Screen configScreen(Screen parent) {
.binding(defaults.perspectiveCrosshair, () -> config.perspectiveCrosshair, newVal -> config.perspectiveCrosshair = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.option(Option.createBuilder(boolean.class)
.name(Text.literal("Old Projectiles"))
.description(OptionDescription.of(Text.of("Reverts the projectile's positions back to the older style.")))
.binding(defaults.oldProjectiles, () -> config.oldProjectiles, newVal -> config.oldProjectiles = newVal)
.controller(TickBoxControllerBuilder::create)
.build())
.build())
)).generateScreen(parent);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ public boolean removeMethodCall2(BipedEntityModel<?> instance, T entity) {
return !LegacyAnimationsSettings.CONFIG.instance().oldSneaking;
}


@Inject(
method = "setAngles(Lnet/minecraft/entity/LivingEntity;FFFFF)V",
at = @At(
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
package com.mixces.legacyanimations.mixin;

import com.llamalad7.mixinextras.injector.wrapoperation.Operation;
import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation;
import com.mixces.legacyanimations.config.LegacyAnimationsSettings;
import net.minecraft.client.render.VertexConsumerProvider;
import net.minecraft.client.render.entity.FlyingItemEntityRenderer;
import net.minecraft.client.util.math.MatrixStack;
import net.minecraft.entity.Entity;
import org.objectweb.asm.Opcodes;
import org.spongepowered.asm.mixin.Mixin;
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.callback.CallbackInfo;

@Mixin(FlyingItemEntityRenderer.class)
public class FlyingItemEntityRendererMixin<T extends Entity> {

@WrapOperation(
method = "render",
at = @At(
value = "FIELD",
opcode = Opcodes.GETFIELD,
target = "Lnet/minecraft/entity/Entity;age:I"
)
)
public int disableCleanView(Entity instance, Operation<Integer> original) {
return 2;
}

@Inject(
method = "render",
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/item/ItemRenderer;renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformationMode;IILnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;Lnet/minecraft/world/World;I)V"
)
)
public void shiftProjectile(T entity, float yaw, float tickDelta, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, CallbackInfo ci) {
matrices.translate(0.25F, 0.0F, 0.0F);
}

}
1 change: 1 addition & 0 deletions src/main/resources/legacyanimations.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"ClientPlayerInteractionManagerMixin",
"DebugHudMixin",
"FishingBobberEntityRendererMixin",
"FlyingItemEntityRendererMixin",
"HeldItemRendererMixin",
"InGameHudMixin",
"LivingEntityInvoker",
Expand Down

0 comments on commit 91a6d41

Please sign in to comment.