Skip to content

Commit

Permalink
fixed slim
Browse files Browse the repository at this point in the history
  • Loading branch information
AmyMialee committed Sep 3, 2023
1 parent fca42c9 commit 6555328
Show file tree
Hide file tree
Showing 13 changed files with 19 additions and 88 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
Rat's Mischief 2.0.1 - 1.19.2
------------------------------------------------------
- Fixed a server crash caused by the MialeeMisc library
- Fixed Rat Master Armour slim arms not being slim

------------------------------------------------------
Rat's Mischief 2.0 - 1.19.2
Expand Down
3 changes: 0 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ dependencies {
// mialee misc
modImplementation include("xyz.amymialee:mialeemisc:${project.mialeemisc_version}")

// elegant armor
modLocalImplementation("xyz.amymialee:elegantarmour:${project.elegantarmour_version}") { transitive = false }

// ok zoomer
// runtimeOnly("com.github.EnnuiL:OkZoomer:1.19.2-SNAPSHOT")

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ cca_version=5.0.2
carpet_version=1.19.1-1.4.83+v220727
geckolib_version=geckolib-quilt-1.19:3.1.41
mixin_extras_version=0.2.0-beta.4
mialeemisc_version=1.0.38
mialeemisc_version=1.0.39
pal_version = 1.6.0
requiem_version = 2.0.0-beta.16.stripped
automatone_version = 0.9.0
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
import net.minecraft.client.render.entity.EntityRendererFactory;

public interface EntityRendererWrapper {
EntityRendererFactory.Context getContext();
EntityRendererFactory.Context mischief$getContext();
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package ladysnake.ratsmischief.common.util;

public interface PlayerEntityRendererWrapper {
boolean isSlim();
boolean mischief$isSlim();
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import ladysnake.ratsmischief.common.item.RatMasterArmorItem;
import ladysnake.ratsmischief.common.item.RatMasterCloakItem;
import ladysnake.ratsmischief.common.item.RatMasterHoodItem;
import ladysnake.ratsmischief.common.item.RatMasterMaskItem;
import ladysnake.ratsmischief.common.util.EntityRendererWrapper;
import ladysnake.ratsmischief.common.util.PlayerEntityRendererWrapper;
import net.minecraft.client.render.OverlayTexture;
Expand Down Expand Up @@ -35,16 +34,11 @@

@Mixin(ArmorFeatureRenderer.class)
public abstract class ArmorFeatureRendererMixin<T extends LivingEntity, M extends BipedEntityModel<T>, A extends BipedEntityModel<T>> extends FeatureRenderer<T, M> {
@Unique
private static final Map<String, Identifier> ARMOR_TEXTURE_CACHE = Maps.newHashMap();
@Unique
private static final Map<String, Identifier> SLIM_ARMOR_TEXTURE_CACHE = Maps.newHashMap();
@Unique
private PlayerEntityModel<LivingEntity> leggingsModel;
@Unique
private PlayerEntityModel<LivingEntity> bodyModel;
@Unique
private boolean slim = false;
@Unique private static final Map<String, Identifier> ARMOR_TEXTURE_CACHE = Maps.newHashMap();
@Unique private static final Map<String, Identifier> SLIM_ARMOR_TEXTURE_CACHE = Maps.newHashMap();
@Unique private PlayerEntityModel<LivingEntity> leggingsModel;
@Unique private PlayerEntityModel<LivingEntity> bodyModel;
@Unique private boolean slim;

public ArmorFeatureRendererMixin(FeatureRendererContext<T, M> context) {
super(context);
Expand All @@ -54,10 +48,10 @@ public ArmorFeatureRendererMixin(FeatureRendererContext<T, M> context) {
private void mischief$init(FeatureRendererContext<T, M> context, A leggingsModel, A bodyModel, CallbackInfo ci) {
if (context instanceof EntityRendererWrapper wrapper) {
if (context instanceof PlayerEntityRendererWrapper playerWrapper) {
this.slim = playerWrapper.isSlim();
this.slim = playerWrapper.mischief$isSlim();
}
this.leggingsModel = new PlayerEntityModel<>(wrapper.getContext().getPart(RatsMischiefClient.RAT_MASTER_ARMOR_INNER_LAYER), false);
this.bodyModel = new PlayerEntityModel<>(wrapper.getContext().getPart(this.slim ? RatsMischiefClient.RAT_MASTER_ARMOR_OUTER_LAYER_SLIM : RatsMischiefClient.RAT_MASTER_ARMOR_OUTER_LAYER), this.slim);
this.leggingsModel = new PlayerEntityModel<>(wrapper.mischief$getContext().getPart(RatsMischiefClient.RAT_MASTER_ARMOR_INNER_LAYER), this.slim);
this.bodyModel = new PlayerEntityModel<>(wrapper.mischief$getContext().getPart(this.slim ? RatsMischiefClient.RAT_MASTER_ARMOR_OUTER_LAYER_SLIM : RatsMischiefClient.RAT_MASTER_ARMOR_OUTER_LAYER), this.slim);
}
}

Expand All @@ -67,10 +61,6 @@ public ArmorFeatureRendererMixin(FeatureRendererContext<T, M> context) {
if (itemStack.getItem() instanceof RatMasterArmorItem) {
this.renderRatArmor(matrices, vertexConsumers, entity, armorSlot, light);
ci.cancel();
return;
}
if (armorSlot == EquipmentSlot.HEAD && RatMasterMaskItem.isWearingMask(entity)) {
ci.cancel();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public class EntityRendererMixin<T extends Entity> implements EntityRendererWrap
}

@Override
public EntityRendererFactory.Context getContext() {
public EntityRendererFactory.Context mischief$getContext() {
return this.context;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
@Mixin(PlayerEntityRenderer.class)
public abstract class PlayerEntityRendererMixin extends LivingEntityRenderer<AbstractClientPlayerEntity, PlayerEntityModel<AbstractClientPlayerEntity>> implements PlayerEntityRendererWrapper {
@Unique
private boolean isSlim = false;
private boolean isSlim = true;

public PlayerEntityRendererMixin(EntityRendererFactory.Context ctx, PlayerEntityModel<AbstractClientPlayerEntity> model, float shadowRadius) {
super(ctx, model, shadowRadius);
Expand All @@ -36,7 +36,7 @@ public PlayerEntityRendererMixin(EntityRendererFactory.Context ctx, PlayerEntity
}
}

@Inject(method = "<init>", at = @At("TAIL"))
@Inject(method = "<init>", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/entity/PlayerEntityRenderer;addFeature(Lnet/minecraft/client/render/entity/feature/FeatureRenderer;)Z", ordinal = 0))
private void mischief$masterArmor(EntityRendererFactory.Context ctx, boolean slim, CallbackInfo ci) {
this.isSlim = slim;
}
Expand All @@ -57,7 +57,7 @@ public PlayerEntityRendererMixin(EntityRendererFactory.Context ctx, PlayerEntity
}

@Override
public boolean isSlim() {
public boolean mischief$isSlim() {
return this.isSlim;
}
}

This file was deleted.

3 changes: 2 additions & 1 deletion src/main/resources/quilt.mod.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@
"doctor4t": "Owner",
"Arathain": "Artist",
"Luxintrus": "Artist",
"Pyrofab": "Contributor"
"Pyrofab": "Contributor",
"AmyMialee": "Programmer"
},
"icon": "assets/ratsmischief/icon.png"
},
Expand Down
3 changes: 1 addition & 2 deletions src/main/resources/ratsmischief.mixins.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,7 @@
"client.HeadFeatureRendererMixin",
"client.HeldItemRendererMixin",
"client.ItemEntityRendererMixin",
"client.PlayerEntityRendererMixin",
"compat.ElegantArmour$SlimArmorFeatureRendererMixin"
"client.PlayerEntityRendererMixin"
],
"injectors": {
"defaultRequire": 1
Expand Down

0 comments on commit 6555328

Please sign in to comment.