mirror of
https://github.com/MineLittlePony/MineLittlePony.git
synced 2024-11-23 12:58:01 +01:00
Fixed skulls not always rendering with magic effects
This commit is contained in:
parent
232089bfad
commit
d08c43ffba
5 changed files with 34 additions and 8 deletions
|
@ -0,0 +1,25 @@
|
||||||
|
package com.minelittlepony.mixin;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Inject;
|
||||||
|
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||||
|
|
||||||
|
import com.minelittlepony.render.PonySkullRenderer;
|
||||||
|
|
||||||
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
||||||
|
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
||||||
|
|
||||||
|
@Mixin(GlStateManager.class)
|
||||||
|
public abstract class MixinGlStateManager {
|
||||||
|
|
||||||
|
@Inject(method = "enableBlendProfile(Lnet/minecraft/client/renderer/GlStateManager$Profile;)V", at = @At("HEAD"), cancellable = true)
|
||||||
|
private static void enableBlendProfile(GlStateManager.Profile profile, CallbackInfo info) {
|
||||||
|
if (profile == GlStateManager.Profile.PLAYER_SKIN && PonySkullRenderer.ponyInstance.usesTransparency()) {
|
||||||
|
GlStateManager.enableBlend();
|
||||||
|
GlStateManager.tryBlendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
|
||||||
|
info.cancel();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -35,6 +35,7 @@ public class LevitatingItemRenderer {
|
||||||
|
|
||||||
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
RenderItem renderItem = Minecraft.getMinecraft().getRenderItem();
|
||||||
((IRenderItem) renderItem).useTransparency(true);
|
((IRenderItem) renderItem).useTransparency(true);
|
||||||
|
PonySkullRenderer.ponyInstance.useTransparency(true);
|
||||||
|
|
||||||
scale(1.1, 1.1, 1.1);
|
scale(1.1, 1.1, 1.1);
|
||||||
|
|
||||||
|
@ -44,6 +45,7 @@ public class LevitatingItemRenderer {
|
||||||
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
|
renderItem.renderItem(drop, entity, transform, hand == EnumHandSide.LEFT);
|
||||||
|
|
||||||
((IRenderItem) renderItem).useTransparency(false);
|
((IRenderItem) renderItem).useTransparency(false);
|
||||||
|
PonySkullRenderer.ponyInstance.useTransparency(false);
|
||||||
unsetColor();
|
unsetColor();
|
||||||
enableLighting();
|
enableLighting();
|
||||||
popMatrix();
|
popMatrix();
|
||||||
|
|
|
@ -139,6 +139,10 @@ public class PonySkullRenderer extends TileEntitySkullRenderer implements IRende
|
||||||
transparency = use;
|
transparency = use;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean usesTransparency() {
|
||||||
|
return transparency;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A skull, just a skull.
|
* A skull, just a skull.
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,8 +18,6 @@ import com.voxelmodpack.hdskins.HDSkinManager;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.GlStateManager.DestFactor;
|
|
||||||
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
|
|
||||||
import net.minecraft.client.renderer.entity.RenderManager;
|
import net.minecraft.client.renderer.entity.RenderManager;
|
||||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
@ -39,12 +37,8 @@ public class RenderPonyPlayer extends RenderPonyBase {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preRender(boolean transparency) {
|
public void preRender(boolean transparency) {
|
||||||
if (transparency) {
|
|
||||||
GlStateManager.tryBlendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
|
|
||||||
} else {
|
|
||||||
GlStateManager.enableBlendProfile(GlStateManager.Profile.PLAYER_SKIN);
|
GlStateManager.enableBlendProfile(GlStateManager.Profile.PLAYER_SKIN);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResourceLocation getSkinResource(GameProfile profile) {
|
public ResourceLocation getSkinResource(GameProfile profile) {
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
"MixinNetworkPlayerInfo",
|
"MixinNetworkPlayerInfo",
|
||||||
"MixinRenderItem",
|
"MixinRenderItem",
|
||||||
"MixinItemRenderer",
|
"MixinItemRenderer",
|
||||||
"MixinRenderManager"
|
"MixinRenderManager",
|
||||||
|
"MixinGlStateManager"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue