Skip to content
This repository has been archived by the owner on Sep 15, 2024. It is now read-only.

Commit

Permalink
fix entity opacity crash 1.9.3
Browse files Browse the repository at this point in the history
  • Loading branch information
MicrocontrollersDev committed Jun 30, 2024
1 parent 66471be commit 43091fa
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 6 deletions.
2 changes: 1 addition & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ org.gradle.parallel=true
polyfrost.defaults.loom=3

# Mod Properties
mod_version=1.9.2
mod_version=1.9.3
maven_group=dev.microcontrollers.overlaytweaks
archives_base_name=overlaytweaks
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import net.minecraft.entity.passive.PigEntity;
import net.minecraft.entity.passive.StriderEntity;
import net.minecraft.util.Identifier;
import net.minecraft.util.math.ColorHelper;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
Expand All @@ -30,7 +31,7 @@ private RenderLayer transparentEntityRenderLayer(EntityModel model, Identifier t
// TODO: fix pig saddles
assert MinecraftClient.getInstance().player != null;
if (MinecraftClient.getInstance().player.hasVehicle() &&
((OverlayTweaksConfig.CONFIG.instance().horseOpacity != 100 && texture.toString().contains("horse")) ||
((OverlayTweaksConfig.CONFIG.instance().horseOpacity != 100 && texture.toString().contains("horse")) ||
(OverlayTweaksConfig.CONFIG.instance().pigOpacity != 100 && texture.toString().contains("pig")) ||
(OverlayTweaksConfig.CONFIG.instance().striderOpacity != 100 && texture.toString().contains("strider")) ||
(OverlayTweaksConfig.CONFIG.instance().camelOpacity != 100 && texture.toString().contains("camel")))) {
Expand All @@ -46,13 +47,29 @@ private RenderLayer transparentEntityRenderLayer(EntityModel model, Identifier t
//#endif
private void transparentRiddenEntity(Args args, T livingEntity, float f, float g, MatrixStack matrixStack, VertexConsumerProvider vertexConsumerProvider, int i) {
if (livingEntity instanceof AbstractHorseEntity && livingEntity.hasPassenger(MinecraftClient.getInstance().player) && OverlayTweaksConfig.CONFIG.instance().horseOpacity != 0) {
args.set(7, OverlayTweaksConfig.CONFIG.instance().horseOpacity / 100F);
//#if MC >= 1.21
args.set(4, ColorHelper.Argb.fromFloats(OverlayTweaksConfig.CONFIG.instance().horseOpacity / 100F, 1.0F, 1.0F, 1.0F));
//#else
//$$ args.set(7, OverlayTweaksConfig.CONFIG.instance().horseOpacity / 100F);
//#endif
} else if (livingEntity instanceof PigEntity && livingEntity.hasPassenger(MinecraftClient.getInstance().player) && OverlayTweaksConfig.CONFIG.instance().pigOpacity != 0) {
args.set(7, OverlayTweaksConfig.CONFIG.instance().pigOpacity / 100F);
//#if MC >= 1.21
args.set(4, ColorHelper.Argb.fromFloats(OverlayTweaksConfig.CONFIG.instance().pigOpacity / 100F, 1.0F, 1.0F, 1.0F));
//#else
//$$ args.set(7, OverlayTweaksConfig.CONFIG.instance().pigOpacity / 100F);
//#endif
} else if (livingEntity instanceof StriderEntity && livingEntity.hasPassenger(MinecraftClient.getInstance().player) && OverlayTweaksConfig.CONFIG.instance().striderOpacity != 0) {
args.set(7, OverlayTweaksConfig.CONFIG.instance().striderOpacity / 100F);
//#if MC >= 1.21
args.set(4, ColorHelper.Argb.fromFloats(OverlayTweaksConfig.CONFIG.instance().striderOpacity / 100F, 1.0F, 1.0F, 1.0F));
//#else
//$$ args.set(7, OverlayTweaksConfig.CONFIG.instance().striderOpacity / 100F);
//#endif
} else if (livingEntity instanceof CamelEntity && livingEntity.hasPassenger(MinecraftClient.getInstance().player) && OverlayTweaksConfig.CONFIG.instance().camelOpacity != 0) {
args.set(7, OverlayTweaksConfig.CONFIG.instance().camelOpacity / 100F);
//#if MC >= 1.21
args.set(4, ColorHelper.Argb.fromFloats(OverlayTweaksConfig.CONFIG.instance().camelOpacity / 100F, 1.0F, 1.0F, 1.0F));
//#else
//$$ args.set(7, OverlayTweaksConfig.CONFIG.instance().camelOpacity / 100F);
//#endif
}
}

Expand Down

0 comments on commit 43091fa

Please sign in to comment.