mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2025-02-13 16:24:23 +01:00
Fix noskins
This commit is contained in:
parent
e4a4de75b0
commit
4346ccda37
2 changed files with 59 additions and 3 deletions
|
@ -0,0 +1,55 @@
|
|||
package com.minelittlepony.mixin;
|
||||
|
||||
import com.minelittlepony.MineLittlePony;
|
||||
import com.minelittlepony.PonyManager;
|
||||
import com.minelittlepony.pony.data.PonyLevel;
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
@Mixin(DefaultPlayerSkin.class)
|
||||
public abstract class MixinDefaultPlayerSkin {
|
||||
|
||||
@Shadow
|
||||
private static boolean isSlimSkin(UUID playerUUID) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Shadow
|
||||
public static ResourceLocation getDefaultSkin(UUID playerUUID) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Inject(method = "getDefaultSkinLegacy", at = @At("HEAD"), cancellable = true)
|
||||
private static void legacySkin(CallbackInfoReturnable<ResourceLocation> cir) {
|
||||
if (MineLittlePony.getConfig().getPonyLevel() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(PonyManager.STEVE);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getDefaultSkin", at = @At("HEAD"), cancellable = true)
|
||||
private static void defaultSkin(UUID uuid, CallbackInfoReturnable<ResourceLocation> cir) {
|
||||
if (MineLittlePony.getConfig().getPonyLevel() == PonyLevel.PONIES) {
|
||||
cir.setReturnValue(isSlimSkin(uuid) ? PonyManager.ALEX : PonyManager.STEVE);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getSkinType", at = @At("HEAD"), cancellable = true)
|
||||
private static void skinType(UUID uuid, CallbackInfoReturnable<String> cir) {
|
||||
if (MineLittlePony.getConfig().getPonyLevel() == PonyLevel.PONIES) {
|
||||
|
||||
cir.setReturnValue(MineLittlePony.getInstance().getManager()
|
||||
.getPony(getDefaultSkin(uuid), uuid)
|
||||
.getRace(false)
|
||||
.getModel()
|
||||
.getId(isSlimSkin(uuid)));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -5,10 +5,11 @@
|
|||
"refmap": "minelp.mixin.refmap.json",
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"mixins": [
|
||||
"MixinThreadDownloadImageData",
|
||||
"MixinRenderItem",
|
||||
"MixinDefaultPlayerSkin",
|
||||
"MixinGlStateManager",
|
||||
"MixinItemRenderer",
|
||||
"MixinRenderItem",
|
||||
"MixinRenderManager",
|
||||
"MixinGlStateManager"
|
||||
"MixinThreadDownloadImageData"
|
||||
]
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue