Fixed 1.7 Enchant Glint

This commit is contained in:
kirillsaint 2023-07-10 19:41:05 +06:00
parent eb88b77ddf
commit 369a787dff
2 changed files with 38 additions and 41 deletions

View File

@ -1,15 +1,20 @@
package net.silentclient.client.mixin.mixins;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumAction;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.Client;
import net.silentclient.client.mods.render.AnimationsMod;
import net.silentclient.client.utils.animations.AnimationHandler;
import org.spongepowered.asm.mixin.Final;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.Unique;
@ -31,10 +36,42 @@ public abstract class RenderItemMixin {
@Shadow protected abstract void renderEffect(IBakedModel model);
@Shadow protected abstract void renderModel(IBakedModel model, int color);
@Shadow @Final private static ResourceLocation RES_ITEM_GLINT;
@Redirect(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/resources/model/IBakedModel;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/entity/RenderItem;renderEffect(Lnet/minecraft/client/resources/model/IBakedModel;)V"))
public void renderItemEffect(RenderItem instance, IBakedModel model) {
if(Client.getInstance().getModInstances().getModByClass(AnimationsMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "1.7 Enchant Glint").getValBoolean()) {
AnimationsMod.renderOldEnchantEffect(instance, model);
if(model != null) {
GlStateManager.depthMask(false);
GlStateManager.depthFunc(514);
GlStateManager.disableLighting();
GlStateManager.blendFunc(768, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(RES_ITEM_GLINT);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(8.0, 8.0, 8.0);
GlStateManager.translate((Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F, 0.0F, 0.0F);
GlStateManager.rotate(-5.0F, 0.0F, 0.0F, 1.0F);
renderModel(model, -8372020);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.scale(8.0, 8.0, 8.0);
GlStateManager.translate((Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F, 0.0F, 0.0F);
GlStateManager.rotate(205.0F, 0.0F, 0.0F, 1.0F);
renderModel(model, -8372020);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
GlStateManager.blendFunc(770, 771);
GlStateManager.enableLighting();
GlStateManager.depthFunc(515);
GlStateManager.depthMask(true);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
}
} else {
renderEffect(model);
}

View File

@ -1,11 +1,5 @@
package net.silentclient.client.mods.render;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.entity.RenderItem;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.model.IBakedModel;
import net.minecraft.util.ResourceLocation;
import net.silentclient.client.mods.Mod;
import net.silentclient.client.mods.ModCategory;
@ -31,38 +25,4 @@ public class AnimationsMod extends Mod {
this.addBooleanSetting("Smooth Sneaking", this, true);
this.addBooleanSetting("No Shaking", this, true);
}
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
public static void renderOldEnchantEffect(RenderItem instance, IBakedModel model) {
if(model != null) {
GlStateManager.depthMask(false);
GlStateManager.depthFunc(514);
GlStateManager.disableLighting();
GlStateManager.blendFunc(768, 1);
Minecraft.getMinecraft().getTextureManager().bindTexture(RES_ITEM_GLINT);
GlStateManager.matrixMode(5890);
GlStateManager.pushMatrix();
GlStateManager.scale(8.0, 8.0, 8.0);
GlStateManager.translate((Minecraft.getSystemTime() % 3000L) / 3000.0F / 8.0F, 0.0F, 0.0F);
GlStateManager.rotate(-5.0F, 0.0F, 0.0F, 1.0F);
// ((RenderItemAccessor) instance).renderModel(model, -8372020);
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
GlStateManager.scale(8.0, 8.0, 8.0);
GlStateManager.translate((Minecraft.getSystemTime() % 4873L) / 4873.0F / 8.0F, 0.0F, 0.0F);
GlStateManager.rotate(205.0F, 0.0F, 0.0F, 1.0F);
// ((RenderItemAccessor) instance).renderModel(model, -8372020);
GlStateManager.popMatrix();
GlStateManager.matrixMode(5888);
GlStateManager.blendFunc(770, 771);
GlStateManager.enableLighting();
GlStateManager.depthFunc(515);
GlStateManager.depthMask(true);
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
}
}
}