Skip to content

Commit

Permalink
Fix Witchery's Mirror Reflections
Browse files Browse the repository at this point in the history
Allow getDownloadImageSkin() fixes (such as #237) to apply to Witchery's Mirror content (demon reflections, player camouflage and sleeping bodies).

This wasn't fixed before due to Witchery's decision to copy and paste that vanilla class rather than reference it.
  • Loading branch information
DrParadox7 authored and mitchej123 committed Oct 28, 2023
1 parent a79c638 commit 18c15da
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/LoadingConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public class LoadingConfig {
public boolean deduplicateForestryCompatInBOP;
public boolean dimensionManagerDebug;
public boolean disableWitcheryPotionExtender;
public boolean fixWitcheryReflections;
public boolean displayIc2FluidLocalizedName;
public boolean dropPickedLootOnDespawn;
public boolean enableDefaultLanPort;
Expand Down Expand Up @@ -214,6 +215,7 @@ public LoadingConfig(File file) {
defaultLanPort = config.get(Category.TWEAKS.toString(), "defaultLanPort", 25565, "Specify default LAN port to open an integrated server on. Set to 0 to always open the server on an automatically allocated port.").getInt();
dimensionManagerDebug = config.get(Category.DEBUG.toString(), "dimensionManagerDebug", true, "Prints debug log if DimensionManager got crashed").getBoolean();
disableWitcheryPotionExtender = config.get(Category.FIXES.toString(), "disableWitcheryPotionExtender", true, "Disable Witchery potion extender for Java 12 compat").getBoolean();
fixWitcheryReflections = config.get(Category.FIXES.toString(), "fixWitcheryReflections", true, "Fixes Witchery player skins reflections with inhabited mirrors").getBoolean();
displayIc2FluidLocalizedName = config.get(Category.TWEAKS.toString(), "displayIc2FluidLocalizedName", true, "Display fluid localized name in IC2 fluid cell tooltip").getBoolean();
dropPickedLootOnDespawn = config.get(Category.TWEAKS.toString(), "dropPickedLootOnDespawn", true, "Drop picked loot on entity despawn").getBoolean();
enableDefaultLanPort = config.get(Category.TWEAKS.toString(), "enableDefaultLanPort", true, "Open an integrated server on a static port.").getBoolean();
Expand Down
4 changes: 4 additions & 0 deletions src/main/java/com/mitchej123/hodgepodge/mixins/Mixins.java
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,10 @@ public enum Mixins {
.addMixinClasses("witchery.MixinPotionArrayExtender").setSide(Side.BOTH)
.setApplyIf(() -> Common.config.disableWitcheryPotionExtender).addTargetedMod(TargetedMod.WITCHERY)),

Fix_WitcheryReflectionSkin(new Builder("Fixes Witchery player skins reflections")
.addMixinClasses("witchery.MixinExtendedPlayer", "witchery.MixinEntityReflection").setSide(Side.CLIENT)
.setApplyIf(() -> Common.config.fixWitcheryReflections).addTargetedMod(TargetedMod.WITCHERY)),

// Various Exploits/Fixes
GC_TIME_COMMAND_FIX(new Builder("GC Time Fix").addMixinClasses("minecraft.MixinTimeCommandGalacticraftFix")
.setPhase(Phase.EARLY).setSide(Side.BOTH).setApplyIf(() -> Common.config.fixTimeCommandWithGC)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.mitchej123.hodgepodge.mixins.late.witchery;

import static net.minecraft.client.entity.AbstractClientPlayer.getDownloadImageSkin;

import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.util.ResourceLocation;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import com.emoniph.witchery.entity.EntityReflection;

@Mixin(EntityReflection.class)
public class MixinEntityReflection {

@Redirect(
method = "setupCustomSkin",
at = @At(
value = "INVOKE",
target = "Lcom/emoniph/witchery/entity/EntityReflection;getDownloadImageSkin(Lnet/minecraft/util/ResourceLocation;Ljava/lang/String;)Lnet/minecraft/client/renderer/ThreadDownloadImageData;"),
remap = false)
private ThreadDownloadImageData hodgepodge$getDownloadImageSkin(ResourceLocation location, String name) {
return getDownloadImageSkin(location, name);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package com.mitchej123.hodgepodge.mixins.late.witchery;

import static net.minecraft.client.entity.AbstractClientPlayer.getDownloadImageSkin;

import net.minecraft.client.renderer.ThreadDownloadImageData;
import net.minecraft.util.ResourceLocation;

import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;

import com.emoniph.witchery.common.ExtendedPlayer;

@Mixin(ExtendedPlayer.class)
public class MixinExtendedPlayer {

@Redirect(
method = "setupCustomSkin",
at = @At(
value = "INVOKE",
target = "Lcom/emoniph/witchery/common/ExtendedPlayer;getDownloadImageSkin(Lnet/minecraft/util/ResourceLocation;Ljava/lang/String;)Lnet/minecraft/client/renderer/ThreadDownloadImageData;"),
remap = false)
private ThreadDownloadImageData hodgepodge$getDownloadImageSkin(ResourceLocation location, String name) {
return getDownloadImageSkin(location, name);
}
}

0 comments on commit 18c15da

Please sign in to comment.