2
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
2.5 KiB
Java

package com.zivilon.cinder_loe.mixins;
import com.zivilon.cinder_loe.client.render.item.RenderHelper;
import com.zivilon.cinder_loe.CinderLoE_Config;
import org.lwjgl.opengl.GL11;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Overwrite;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
import lotr.client.LOTRClientProxy;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.util.ResourceLocation;
@Mixin(LOTRClientProxy.class)
public abstract class MixinLOTRClientProxy {
@Shadow(remap = false)
public static final ResourceLocation enchantmentTexture = new ResourceLocation("textures/misc/enchanted_item_glint.png");
/**
* @author Shinare
* @reason Added support for semi-transparent item textures
*/
@Overwrite(remap = false)
public static void renderEnchantmentEffect() {
Tessellator tessellator = Tessellator.instance;
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
GL11.glDepthFunc(514);
GL11.glDisable(2896);
texturemanager.bindTexture(enchantmentTexture);
GL11.glEnable(3042);
GL11.glBlendFunc(768, 1);
GL11.glColor4f(CinderLoE_Config.enchantment_color_red, CinderLoE_Config.enchantment_color_green, CinderLoE_Config.enchantment_color_blue, 1.0F);
GL11.glMatrixMode(5890);
GL11.glPushMatrix();
float scale = 0.125F;
GL11.glScalef(scale, scale, scale);
float randomShift = (float)(Minecraft.getSystemTime() % 3000L) / 3000.0F * 8.0F;
GL11.glTranslatef(randomShift, 0.0F, 0.0F);
GL11.glRotatef(-50.0F, 0.0F, 0.0F, 1.0F);
RenderHelper.customRenderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, true);
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
randomShift = (float)(Minecraft.getSystemTime() % 4873L) / 4873.0F * 8.0F;
GL11.glTranslatef(-randomShift, 0.0F, 0.0F);
GL11.glRotatef(10.0F, 0.0F, 0.0F, 1.0F);
RenderHelper.customRenderItemIn2D(tessellator, 0.0F, 0.0F, 1.0F, 1.0F, 256, 256, 0.0625F, true);
GL11.glPopMatrix();
GL11.glMatrixMode(5888);
GL11.glDisable(3042);
GL11.glEnable(2896);
GL11.glDepthFunc(515);
}
}