mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:31:32 +01:00
Fixes
This commit is contained in:
parent
1a474dbe99
commit
c6b324f384
@ -1,11 +1,7 @@
|
||||
package net.silentclient.client.mixin;
|
||||
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.launchwrapper.IClassTransformer;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mixin.visitors.RenderCloudsFancy;
|
||||
import net.silentclient.client.mixin.visitors.RenderCloudsFast;
|
||||
import net.silentclient.client.utils.ClientUtils;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.ClassWriter;
|
||||
@ -31,14 +27,6 @@ public class SilentClientTransformer implements IClassTransformer {
|
||||
return classwriter.toByteArray();
|
||||
}
|
||||
|
||||
if (transformedName.equals(RenderGlobal.class.getName())) {
|
||||
Client.logger.info("Transforming class: " + transformedName);
|
||||
final ClassReader classReader5 = new ClassReader(bytes);
|
||||
final ClassWriter classWriter5 = new ClassWriter(1);
|
||||
classReader5.accept((ClassVisitor)new RenderGlobalClassVisitor(262144, classWriter5), 0);
|
||||
return classWriter5.toByteArray();
|
||||
}
|
||||
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@ -46,26 +34,6 @@ public class SilentClientTransformer implements IClassTransformer {
|
||||
return clazz.getName().replace(".", "/");
|
||||
}
|
||||
|
||||
public static class RenderGlobalClassVisitor extends ClassVisitor
|
||||
{
|
||||
private RenderGlobalClassVisitor(final int n, final ClassWriter classWriter) {
|
||||
super(n, (ClassVisitor)classWriter);
|
||||
}
|
||||
|
||||
public MethodVisitor visitMethod(final int n, final String s, final String s2, final String s3, final String[] array) {
|
||||
final MethodVisitor visitMethod = super.visitMethod(n, s, s2, s3, array);
|
||||
if (s.equals(ClientUtils.isDevelopment() ? "renderClouds" : "b") && s2.equals("(FI)V")) {
|
||||
Client.logger.info("Transforming method: " + s);
|
||||
return new RenderCloudsFast(this.api, visitMethod);
|
||||
}
|
||||
if (s.equals(ClientUtils.isDevelopment() ? "renderCloudsFancy" : "c") && s2.equals("(FI)V")) {
|
||||
Client.logger.info("Transforming method: " + s);
|
||||
return new RenderCloudsFancy(this.api, visitMethod);
|
||||
}
|
||||
return visitMethod;
|
||||
}
|
||||
}
|
||||
|
||||
public class AccessTransformerVisitor extends ClassVisitor {
|
||||
|
||||
public AccessTransformerVisitor(int api, ClassVisitor cv) {
|
||||
|
@ -5,6 +5,8 @@ import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.gui.GuiIngame;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.culling.Frustum;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.client.shader.ShaderGroup;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -21,6 +23,7 @@ import net.silentclient.client.mixin.ducks.EntityRendererExt;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import net.silentclient.client.mods.render.NewMotionBlurMod;
|
||||
import net.silentclient.client.mods.settings.RenderMod;
|
||||
import net.silentclient.client.utils.CloudRenderer;
|
||||
import net.silentclient.client.utils.HUDCaching;
|
||||
import net.silentclient.client.utils.culling.EntityCulling;
|
||||
import net.silentclient.client.utils.shader.MotionBlurUtils;
|
||||
@ -272,4 +275,10 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
||||
private void silent$disablePolygonOffset(CallbackInfo ci) {
|
||||
GlStateManager.disablePolygonOffset();
|
||||
}
|
||||
|
||||
@Redirect(method = "renderWorldPass", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/culling/ICamera;setPosition(DDD)V"))
|
||||
public void initFrustum(ICamera instance, double v1, double v2, double v3) {
|
||||
CloudRenderer.setFrustum((Frustum) instance);
|
||||
instance.setPosition(v1, v2, v3);
|
||||
}
|
||||
}
|
||||
|
@ -1,31 +1,31 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.network.NetworkPlayerInfo;
|
||||
import net.minecraft.client.resources.DefaultPlayerSkin;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mixin.accessors.AbstractClientPlayerAccessor;
|
||||
import net.silentclient.client.mixin.accessors.NetworkPlayerInfoAccessor;
|
||||
import net.silentclient.client.mods.player.NickHiderMod;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import net.silentclient.client.utils.NetworkPlayerInfoOptimization;
|
||||
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 org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(NetworkPlayerInfo.class)
|
||||
public abstract class NetworkPlayerInfoMixin {
|
||||
@Shadow @Final private GameProfile gameProfile;
|
||||
@Inject(method = "loadPlayerTextures", at = @At("HEAD"))
|
||||
public void optimizationOfLoadingTexturesStart(CallbackInfo ci) {
|
||||
if(NetworkPlayerInfoOptimization.isLoadingSkin) {
|
||||
return;
|
||||
}
|
||||
NetworkPlayerInfoOptimization.isLoadingSkin = true;
|
||||
}
|
||||
|
||||
@Shadow private String skinType;
|
||||
|
||||
@Shadow public abstract GameProfile getGameProfile();
|
||||
|
||||
@Inject(method = "getSkinType", at = @At("HEAD"))
|
||||
public void customSkinType(CallbackInfoReturnable<String> cir) {
|
||||
@Inject(method = "loadPlayerTextures", at = @At("HEAD"))
|
||||
public void optimizationOfLoadingTexturesEnd(CallbackInfo ci) {
|
||||
(new Thread(() -> {
|
||||
try {
|
||||
Thread.sleep(1000);
|
||||
} catch (InterruptedException e) {
|
||||
|
||||
}
|
||||
NetworkPlayerInfoOptimization.isLoadingSkin = false;
|
||||
})).start();
|
||||
}
|
||||
}
|
||||
|
@ -1,23 +1,36 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.WorldClient;
|
||||
import net.minecraft.client.renderer.RenderGlobal;
|
||||
import net.minecraft.client.renderer.chunk.VisGraph;
|
||||
import net.minecraft.client.renderer.culling.ICamera;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.silentclient.client.event.impl.RenderTickEvent;
|
||||
import net.silentclient.client.mixin.ducks.VisGraphExt;
|
||||
import net.silentclient.client.mods.render.BlockOverlayMod;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
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.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(RenderGlobal.class)
|
||||
public class RenderGlobalMixin {
|
||||
public abstract class RenderGlobalMixin {
|
||||
@Shadow @Final private Minecraft mc;
|
||||
|
||||
@Shadow @Final private TextureManager renderEngine;
|
||||
|
||||
@Shadow @Final private static ResourceLocation locationCloudsPng;
|
||||
|
||||
@Shadow private WorldClient theWorld;
|
||||
|
||||
@Shadow private int cloudTickCounter;
|
||||
|
||||
@Inject(method = "renderEntities", at = @At("HEAD"))
|
||||
public void tickEvent(Entity renderViewEntity, ICamera camera, float partialTicks, CallbackInfo ci) {
|
||||
new RenderTickEvent().call();
|
||||
@ -32,10 +45,4 @@ public class RenderGlobalMixin {
|
||||
{
|
||||
BlockOverlayMod.drawSelectionBox(player, movingObjectPositionIn, p_72731_3_, partialTicks);
|
||||
}
|
||||
|
||||
@ModifyVariable(method = "getVisibleFacings", name = "visgraph", at = @At(value = "STORE", ordinal = 0))
|
||||
private VisGraph silent$setLimitScan(VisGraph visgraph) {
|
||||
((VisGraphExt) visgraph).silent$setLimitScan(true);
|
||||
return visgraph;
|
||||
}
|
||||
}
|
||||
|
@ -1,140 +0,0 @@
|
||||
package net.silentclient.client.mixin.visitors;
|
||||
|
||||
import org.objectweb.asm.Handle;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.Attribute;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
|
||||
public class ClearingMethodVisitor extends MethodVisitor
|
||||
{
|
||||
protected boolean clear;
|
||||
|
||||
public ClearingMethodVisitor(final int n, final MethodVisitor methodVisitor) {
|
||||
super(n, methodVisitor);
|
||||
this.clear = false;
|
||||
}
|
||||
|
||||
public void visitAttribute(final Attribute attribute) {
|
||||
if (!this.clear) {
|
||||
super.visitAttribute(attribute);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitCode() {
|
||||
if (!this.clear) {
|
||||
super.visitCode();
|
||||
}
|
||||
}
|
||||
|
||||
public void visitTableSwitchInsn(final int n, final int n2, final Label label, final Label... array) {
|
||||
super.visitTableSwitchInsn(n, n2, label, array);
|
||||
}
|
||||
|
||||
public void visitLookupSwitchInsn(final Label label, final int[] array, final Label[] array2) {
|
||||
super.visitLookupSwitchInsn(label, array, array2);
|
||||
}
|
||||
|
||||
public void visitMultiANewArrayInsn(final String s, final int n) {
|
||||
super.visitMultiANewArrayInsn(s, n);
|
||||
}
|
||||
|
||||
public void visitTryCatchBlock(final Label label, final Label label2, final Label label3, final String s) {
|
||||
super.visitTryCatchBlock(label, label2, label3, s);
|
||||
}
|
||||
|
||||
public void visitFrame(final int n, final int n2, final Object[] array, final int n3, final Object[] array2) {
|
||||
if (!this.clear) {
|
||||
super.visitFrame(n, n2, array, n3, array2);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitInsn(final int n) {
|
||||
if (!this.clear) {
|
||||
super.visitInsn(n);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitIntInsn(final int n, final int n2) {
|
||||
if (!this.clear) {
|
||||
super.visitIntInsn(n, n2);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitVarInsn(final int n, final int n2) {
|
||||
if (!this.clear) {
|
||||
super.visitVarInsn(n, n2);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitTypeInsn(final int n, final String s) {
|
||||
if (!this.clear) {
|
||||
super.visitTypeInsn(n, s);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitFieldInsn(final int n, final String s, final String s2, final String s3) {
|
||||
if (!this.clear) {
|
||||
super.visitFieldInsn(n, s, s2, s3);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitMethodInsn(final int n, final String s, final String s2, final String s3) {
|
||||
if (!this.clear) {
|
||||
super.visitMethodInsn(n, s, s2, s3);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitInvokeDynamicInsn(final String s, final String s2, final Handle handle, final Object... array) {
|
||||
if (!this.clear) {
|
||||
super.visitInvokeDynamicInsn(s, s2, handle, array);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitJumpInsn(final int n, final Label label) {
|
||||
if (!this.clear) {
|
||||
super.visitJumpInsn(n, label);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitLabel(final Label label) {
|
||||
if (!this.clear) {
|
||||
super.visitLabel(label);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitLdcInsn(final Object o) {
|
||||
if (!this.clear) {
|
||||
super.visitLdcInsn(o);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitLocalVariable(final String s, final String s2, final String s3, final Label label, final Label label2, final int n) {
|
||||
if (!this.clear) {
|
||||
super.visitLocalVariable(s, s2, s3, label, label2, n);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitLineNumber(final int n, final Label label) {
|
||||
if (!this.clear) {
|
||||
super.visitLineNumber(n, label);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitIincInsn(final int n, final int n2) {
|
||||
if (!this.clear) {
|
||||
super.visitIincInsn(n, n2);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitMaxs(final int n, final int n2) {
|
||||
if (!this.clear) {
|
||||
super.visitMaxs(n, n2);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitEnd() {
|
||||
if (!this.clear) {
|
||||
super.visitEnd();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
package net.silentclient.client.mixin.visitors;
|
||||
|
||||
import net.silentclient.client.mixin.SilentClientTransformer;
|
||||
import net.silentclient.client.utils.CloudRenderer;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
|
||||
public class RenderCloudsFancy extends ClearingMethodVisitor
|
||||
{
|
||||
private boolean alreadyInjected;
|
||||
|
||||
public RenderCloudsFancy(final int n, final MethodVisitor methodVisitor) {
|
||||
super(n, methodVisitor);
|
||||
this.alreadyInjected = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMaxs(final int n, final int n2) {
|
||||
super.visitMaxs(19, n2 - 7);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLocalVariable(final String s, final String s2, final String s3, final Label label, final Label label2, final int n) {
|
||||
if (n < 39) {
|
||||
super.visitLocalVariable(s, s2, s3, label, label2, n);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLineNumber(final int n, final Label label) {
|
||||
if (n == 2237) {
|
||||
this.clear = false;
|
||||
}
|
||||
else if (n == 2260 && !this.alreadyInjected) {
|
||||
this.mv.visitFrame(3, 0, (Object[])null, 0, (Object[])null);
|
||||
this.mv.visitVarInsn(25, 6);
|
||||
this.mv.visitVarInsn(25, 5);
|
||||
this.mv.visitVarInsn(23, 15);
|
||||
this.mv.visitVarInsn(23, 32);
|
||||
this.mv.visitVarInsn(23, 33);
|
||||
this.mv.visitVarInsn(23, 19);
|
||||
this.mv.visitVarInsn(23, 20);
|
||||
this.mv.visitVarInsn(23, 21);
|
||||
this.mv.visitVarInsn(23, 25);
|
||||
this.mv.visitVarInsn(23, 26);
|
||||
this.mv.visitVarInsn(23, 27);
|
||||
this.mv.visitVarInsn(23, 28);
|
||||
this.mv.visitVarInsn(23, 29);
|
||||
this.mv.visitVarInsn(23, 30);
|
||||
this.mv.visitVarInsn(23, 22);
|
||||
this.mv.visitVarInsn(23, 23);
|
||||
this.mv.visitVarInsn(23, 24);
|
||||
this.mv.visitVarInsn(23, 34);
|
||||
this.mv.visitVarInsn(23, 35);
|
||||
this.mv.visitMethodInsn(184, SilentClientTransformer.getClassName(CloudRenderer.class), "renderFancyClouds", "(Lbfd;Lbfx;FFFFFFFFFFFFFFFFF)V");
|
||||
this.mv.visitLabel(new Label());
|
||||
this.alreadyInjected = true;
|
||||
this.clear = true;
|
||||
}
|
||||
else if (n == 2264) {
|
||||
this.clear = true;
|
||||
}
|
||||
else if (n == 2348) {
|
||||
this.clear = false;
|
||||
}
|
||||
super.visitLineNumber(n, label);
|
||||
}
|
||||
}
|
@ -1,55 +0,0 @@
|
||||
package net.silentclient.client.mixin.visitors;
|
||||
|
||||
import net.silentclient.client.mixin.SilentClientTransformer;
|
||||
import net.silentclient.client.utils.CloudRenderer;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.MethodVisitor;
|
||||
|
||||
public class RenderCloudsFast extends ClearingMethodVisitor
|
||||
{
|
||||
private boolean alreadyInjected;
|
||||
|
||||
public RenderCloudsFast(final int n, final MethodVisitor methodVisitor) {
|
||||
super(n, methodVisitor);
|
||||
this.alreadyInjected = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitMaxs(final int n, final int n2) {
|
||||
super.visitMaxs(n, n2 - 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLocalVariable(final String s, final String s2, final String s3, final Label label, final Label label2, final int n) {
|
||||
if (!s.equals("var24") && !s.equals("var25")) {
|
||||
super.visitLocalVariable(s, s2, s3, label, label2, n);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitLineNumber(final int n, final Label label) {
|
||||
if (n == 2101) {
|
||||
this.clear = true;
|
||||
}
|
||||
else if (n == 2103) {
|
||||
this.clear = false;
|
||||
}
|
||||
else if (n == 2133 && !this.alreadyInjected) {
|
||||
this.mv.visitVarInsn(25, 8);
|
||||
this.mv.visitVarInsn(23, 22);
|
||||
this.mv.visitVarInsn(23, 23);
|
||||
this.mv.visitVarInsn(23, 24);
|
||||
this.mv.visitVarInsn(23, 10);
|
||||
this.mv.visitVarInsn(23, 11);
|
||||
this.mv.visitVarInsn(23, 12);
|
||||
this.mv.visitMethodInsn(184, SilentClientTransformer.getClassName(CloudRenderer.class), "renderFastClouds", "(Lbfd;FFFFFF)V");
|
||||
this.mv.visitLabel(new Label());
|
||||
this.alreadyInjected = true;
|
||||
this.clear = true;
|
||||
}
|
||||
else if (n == 2144) {
|
||||
this.clear = false;
|
||||
}
|
||||
super.visitLineNumber(n, label);
|
||||
}
|
||||
}
|
@ -0,0 +1,5 @@
|
||||
package net.silentclient.client.utils;
|
||||
|
||||
public class NetworkPlayerInfoOptimization {
|
||||
public static boolean isLoadingSkin = false;
|
||||
}
|
@ -112,6 +112,7 @@
|
||||
"mixins.RenderTNTPrimedMixin",
|
||||
"mixins.GuiDisconnectedMixin",
|
||||
"accessors.optifine.CustomColorsAccessor",
|
||||
"accessors.optifine.ConfigAccessor"
|
||||
"accessors.optifine.ConfigAccessor",
|
||||
"mixins.NetworkPlayerInfoMixin"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user