Skip to content

Commit

Permalink
1.21 port part 1
Browse files Browse the repository at this point in the history
  • Loading branch information
Mixces committed Aug 8, 2024
1 parent b183b45 commit 1fb52b4
Show file tree
Hide file tree
Showing 30 changed files with 299 additions and 577 deletions.
1 change: 0 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'fabric-loom' version '1.6-SNAPSHOT'
id 'maven-publish'
id 'io.freefair.lombok' version '8.6'
}

version = project.mod_version
Expand Down
8 changes: 4 additions & 4 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ org.gradle.parallel=true

# Fabric Properties
# check these on https://fabricmc.net/develop
minecraft_version=1.20.6
yarn_mappings=1.20.6+build.1
loader_version=0.15.10
minecraft_version=1.21
yarn_mappings=1.21+build.1
loader_version=0.15.11

# Mod Properties
mod_version=1.0.0
maven_group=com.mixces.legacyanimations
archives_base_name=legacyanimations

# Dependencies
fabric_version=0.97.8+1.20.6
fabric_version=0.100.1+1.21
modmenu_version=10.0.0-beta.1
yacl_version=3.4.2+1.20.5
devauth_version=1.2.0
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public class LegacyAnimationsSettings {
@SerialEntry public boolean hideShields = true;
@SerialEntry public boolean hideShieldHotbar = true;
@SerialEntry public boolean noCooldown = true;
@SerialEntry public boolean oldMovement = true;
// @SerialEntry public boolean oldMovement = true; // already in viafabric
@SerialEntry public boolean oldSneaking = true;
@SerialEntry public boolean oldWalking = true;
@SerialEntry public boolean oldDeath = true;
Expand Down Expand Up @@ -234,8 +234,7 @@ public static Screen configScreen(Screen parent) {
.build())
.build();

public static LegacyAnimationsSettings getInstance()
{
public static LegacyAnimationsSettings getInstance() {
return CONFIG.instance();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,10 @@
import net.fabricmc.api.Environment;

@Environment(EnvType.CLIENT)
public class ModMenuIntegration implements ModMenuApi
{
public class ModMenuIntegration implements ModMenuApi {

@Override
public ConfigScreenFactory<?> getModConfigScreenFactory()
{
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return LegacyAnimationsSettings::configScreen;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

import net.minecraft.util.math.Vec3d;

public interface EntityInterface
{
public interface EntityInterface {

Vec3d legacyAnimations$getCameraPosVec(float tickDelta, float eyeHeight);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package com.mixces.legacyanimations.duck;

public interface PlayerPitchInterface
{
public interface PlayerPitchInterface {

float legacyAnimations$getPrevPlayerPitch();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,18 @@
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;

@Mixin(ArmorFeatureRenderer.class)
public abstract class ArmorFeatureRendererMixin<T extends LivingEntity, A extends BipedEntityModel<T>>
{
public abstract class ArmorFeatureRendererMixin<T extends LivingEntity, A extends BipedEntityModel<T>> {

@Unique private T legacyAnimations$entity;
@Unique
private T legacyAnimations$entity;

@Inject(
method = "renderArmor",
at = @At(
value = "HEAD"
)
)
private void legacyAnimations$captureEntity(MatrixStack matrices, VertexConsumerProvider vertexConsumers, T entity, EquipmentSlot armorSlot, int light, A model, CallbackInfo ci)
{
private void legacyAnimations$captureEntity(MatrixStack matrices, VertexConsumerProvider vertexConsumers, T entity, EquipmentSlot armorSlot, int light, A model, CallbackInfo ci) {
legacyAnimations$entity = entity;
}

Expand All @@ -46,13 +45,8 @@ public abstract class ArmorFeatureRendererMixin<T extends LivingEntity, A extend
target = "Lnet/minecraft/client/render/VertexConsumerProvider;getBuffer(Lnet/minecraft/client/render/RenderLayer;)Lnet/minecraft/client/render/VertexConsumer;"
)
)
private RenderLayer legacyAnimations$useEntityLayerRendererArmor(RenderLayer var1, @Local(ordinal = 0, argsOnly = true) Identifier overlay)
{
if (!LegacyAnimationsSettings.getInstance().armorTint)
{
return var1;
}
return RenderLayer.getEntityCutoutNoCullZOffset(overlay);
private RenderLayer legacyAnimations$useEntityLayerRendererArmor(RenderLayer var1, @Local(ordinal = 0, argsOnly = true) Identifier overlay) {
return LegacyAnimationsSettings.getInstance().armorTint ? RenderLayer.getEntityCutoutNoCullZOffset(overlay) : var1;
}

@WrapOperation(
Expand All @@ -62,14 +56,8 @@ public abstract class ArmorFeatureRendererMixin<T extends LivingEntity, A extend
target = "Lnet/minecraft/client/texture/Sprite;getTextureSpecificVertexConsumer(Lnet/minecraft/client/render/VertexConsumer;)Lnet/minecraft/client/render/VertexConsumer;"
)
)
private VertexConsumer legacyAnimations$useEntityLayerRendererTrim(Sprite instance, VertexConsumer consumer, Operation<VertexConsumer> original, @Local(ordinal = 0, argsOnly = true) VertexConsumerProvider vertexConsumers)
{
if (!LegacyAnimationsSettings.getInstance().armorTint)
{
return original.call(instance, consumer);
}

if (legacyAnimations$entity.deathTime > 0 || legacyAnimations$entity.hurtTime > 0) {
private VertexConsumer legacyAnimations$useEntityLayerRendererTrim(Sprite instance, VertexConsumer consumer, Operation<VertexConsumer> original, @Local(ordinal = 0, argsOnly = true) VertexConsumerProvider vertexConsumers) {
if (LegacyAnimationsSettings.getInstance().armorTint && (legacyAnimations$entity.deathTime > 0 || legacyAnimations$entity.hurtTime > 0)) {
return instance.getTextureSpecificVertexConsumer(vertexConsumers.getBuffer(RenderLayer.getEntityCutoutNoCullZOffset(instance.getAtlasId())));
}
return original.call(instance, consumer);
Expand All @@ -82,20 +70,17 @@ public abstract class ArmorFeatureRendererMixin<T extends LivingEntity, A extend
},
at = @At(
value = "INVOKE",
target = "Lnet/minecraft/client/render/entity/model/BipedEntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;IIFFFF)V"
target = "Lnet/minecraft/client/render/entity/model/BipedEntityModel;render(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumer;II)V"
),
index = 3
)
private int legacyAnimations$useDamageUVOverlay(int par3)
{
if (!LegacyAnimationsSettings.getInstance().armorTint)
{
return par3;
private int legacyAnimations$useDamageUVOverlay(int par3) {
if (LegacyAnimationsSettings.getInstance().armorTint) {
return OverlayTexture.packUv(
OverlayTexture.getU(0.0F),
OverlayTexture.getV(legacyAnimations$entity.deathTime > 0 || legacyAnimations$entity.hurtTime > 0)
);
}
return OverlayTexture.packUv(
OverlayTexture.getU(0.0F),
OverlayTexture.getV(legacyAnimations$entity.deathTime > 0 || legacyAnimations$entity.hurtTime > 0)
);
return par3;
}

}
Loading

0 comments on commit 1fb52b4

Please sign in to comment.