Make magic slightly brighter

This commit is contained in:
Sollace 2018-08-20 22:24:22 +02:00
parent 446a38b2fc
commit 63d69d026a
4 changed files with 21 additions and 9 deletions

View file

@ -5,11 +5,10 @@ import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import com.minelittlepony.render.LevitatingItemRenderer;
import com.minelittlepony.render.PonySkullRenderer; import com.minelittlepony.render.PonySkullRenderer;
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;
@Mixin(GlStateManager.class) @Mixin(GlStateManager.class)
public abstract class MixinGlStateManager { public abstract class MixinGlStateManager {
@ -17,8 +16,7 @@ public abstract class MixinGlStateManager {
@Inject(method = "enableBlendProfile(Lnet/minecraft/client/renderer/GlStateManager$Profile;)V", at = @At("HEAD"), cancellable = true) @Inject(method = "enableBlendProfile(Lnet/minecraft/client/renderer/GlStateManager$Profile;)V", at = @At("HEAD"), cancellable = true)
private static void enableBlendProfile(GlStateManager.Profile profile, CallbackInfo info) { private static void enableBlendProfile(GlStateManager.Profile profile, CallbackInfo info) {
if (profile == GlStateManager.Profile.PLAYER_SKIN && PonySkullRenderer.ponyInstance.usesTransparency()) { if (profile == GlStateManager.Profile.PLAYER_SKIN && PonySkullRenderer.ponyInstance.usesTransparency()) {
GlStateManager.enableBlend(); LevitatingItemRenderer.enableItemGlowRenderProfile();
GlStateManager.tryBlendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
info.cancel(); info.cancel();
} }
} }

View file

@ -1,10 +1,8 @@
package com.minelittlepony.mixin; package com.minelittlepony.mixin;
import com.minelittlepony.ducks.IRenderItem; import com.minelittlepony.ducks.IRenderItem;
import com.minelittlepony.render.LevitatingItemRenderer;
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.RenderItem; import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.block.model.IBakedModel; import net.minecraft.client.renderer.block.model.IBakedModel;
import net.minecraft.client.resources.IResourceManagerReloadListener; import net.minecraft.client.resources.IResourceManagerReloadListener;
@ -29,7 +27,7 @@ public abstract class MixinRenderItem implements IResourceManagerReloadListener,
@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/renderer/block/model/IBakedModel;)V", at = @At("HEAD")) @Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/renderer/block/model/IBakedModel;)V", at = @At("HEAD"))
private void onRenderItem(ItemStack stack, IBakedModel model, CallbackInfo info) { private void onRenderItem(ItemStack stack, IBakedModel model, CallbackInfo info) {
if (transparency) { if (transparency) {
GlStateManager.tryBlendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO); LevitatingItemRenderer.enableItemGlowRenderProfile();
} }
} }

View file

@ -4,8 +4,11 @@ import static net.minecraft.client.renderer.GlStateManager.color;
import com.minelittlepony.util.coordinates.Color; import com.minelittlepony.util.coordinates.Color;
import net.minecraft.client.Minecraft;
import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelBase;
import org.lwjgl.opengl.GL11;
public class HornGlowRenderer extends AbstractPonyRenderer<HornGlowRenderer> { public class HornGlowRenderer extends AbstractPonyRenderer<HornGlowRenderer> {
int tint; int tint;
@ -38,8 +41,10 @@ public class HornGlowRenderer extends AbstractPonyRenderer<HornGlowRenderer> {
@Override @Override
public void render(float scale) { public void render(float scale) {
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
Minecraft.getMinecraft().entityRenderer.disableLightmap();
super.render(scale); super.render(scale);
color(1, 1, 1, 1); GL11.glPopAttrib();
} }
@Override @Override

View file

@ -1,5 +1,6 @@
package com.minelittlepony.render; package com.minelittlepony.render;
import org.lwjgl.opengl.GL11;
import org.lwjgl.opengl.GL14; import org.lwjgl.opengl.GL14;
import com.minelittlepony.MineLittlePony; import com.minelittlepony.MineLittlePony;
@ -10,8 +11,12 @@ import com.mumfrey.liteloader.client.overlays.IMinecraft;
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.ItemRenderer; import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.RenderItem; import net.minecraft.client.renderer.RenderItem;
import net.minecraft.client.renderer.GlStateManager.DestFactor;
import net.minecraft.client.renderer.GlStateManager.SourceFactor;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.EnumAction; import net.minecraft.item.EnumAction;
@ -21,6 +26,12 @@ import static net.minecraft.client.renderer.GlStateManager.*;
public class LevitatingItemRenderer { public class LevitatingItemRenderer {
public static void enableItemGlowRenderProfile() {
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(SourceFactor.CONSTANT_COLOR, DestFactor.ONE, SourceFactor.ONE, DestFactor.ZERO);
Minecraft.getMinecraft().entityRenderer.disableLightmap();
}
/** /**
* Renders a magical overlay over an item in third person. * Renders a magical overlay over an item in third person.
*/ */