mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:11:31 +01:00
Animations Fixes
This commit is contained in:
parent
aa84d594f9
commit
55eebc7e64
@ -4,6 +4,7 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.GsonBuilder;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.resources.data.IMetadataSerializer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.silentclient.client.config.ConfigManager;
|
||||
import net.silentclient.client.cosmetics.Cosmetics;
|
||||
@ -74,6 +75,7 @@ public class Client {
|
||||
private SilentSocket silentSocket;
|
||||
public static BackgroundPanorama backgroundPanorama;
|
||||
private KeyBindManager keyBindManager;
|
||||
private IMetadataSerializer iMetadataSerializer;
|
||||
|
||||
public static void memoryDebug(String paramString) {
|
||||
LogManager.getLogger().info("-- Start Memory Debug -- " + paramString);
|
||||
@ -494,4 +496,12 @@ public class Client {
|
||||
public KeyBindManager getKeyBindManager() {
|
||||
return keyBindManager;
|
||||
}
|
||||
|
||||
public IMetadataSerializer getiMetadataSerializer() {
|
||||
return iMetadataSerializer;
|
||||
}
|
||||
|
||||
public void setiMetadataSerializer(IMetadataSerializer iMetadataSerializer) {
|
||||
this.iMetadataSerializer = iMetadataSerializer;
|
||||
}
|
||||
}
|
||||
|
@ -17,65 +17,63 @@ public class SilentClientTweaker implements ITweaker {
|
||||
@Override
|
||||
public final void acceptOptions(List<String> args, File gameDir, File assetsDir, String profile)
|
||||
{
|
||||
Client.logger.info("Silent Client Tweak Loader: Options");
|
||||
try {
|
||||
Class.forName("optifine.Patcher");
|
||||
Class.forName("optifine.OptiFineTweaker");
|
||||
hasOptifine = true;
|
||||
Client.logger.info("Optifine detected!");
|
||||
return;
|
||||
}
|
||||
catch(ClassNotFoundException e) {
|
||||
Client.logger.info("Optifine not found!");
|
||||
}
|
||||
this.launchArgs.addAll(args);
|
||||
Client.logger.info("Optifine loaded: " + hasOptifine);
|
||||
|
||||
final String VERSION = "--version";
|
||||
if(!hasOptifine) {
|
||||
this.launchArgs.addAll(args);
|
||||
|
||||
if (!args.contains(VERSION) && profile != null)
|
||||
{
|
||||
launchArgs.add(VERSION);
|
||||
launchArgs.add(profile);
|
||||
}
|
||||
if (!args.contains("--version") && profile != null)
|
||||
{
|
||||
launchArgs.add("--version");
|
||||
launchArgs.add(profile);
|
||||
}
|
||||
|
||||
if (assetsDir != null) {
|
||||
launchArgs.add("--assetsDir");
|
||||
launchArgs.add(assetsDir.getAbsolutePath());
|
||||
}
|
||||
if (assetsDir != null) {
|
||||
launchArgs.add("--assetsDir");
|
||||
launchArgs.add(assetsDir.getAbsolutePath());
|
||||
}
|
||||
|
||||
if (gameDir != null) {
|
||||
launchArgs.add("--gameDir");
|
||||
launchArgs.add(gameDir.getAbsolutePath());
|
||||
if (gameDir != null) {
|
||||
launchArgs.add("--gameDir");
|
||||
launchArgs.add(gameDir.getAbsolutePath());
|
||||
}
|
||||
} else {
|
||||
this.launchArgs = new ArrayList();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public final void injectIntoClassLoader(LaunchClassLoader classLoader)
|
||||
{
|
||||
Client.logger.info("Silent Client Tweak Loader: Injecting into class loader");
|
||||
MixinBootstrap.init();
|
||||
|
||||
// Retrieve the default mixin environment and register the config file
|
||||
MixinEnvironment environment = MixinEnvironment.getDefaultEnvironment();
|
||||
|
||||
environment.addConfiguration("mixins.SilentClient.json");
|
||||
|
||||
// Check if the obfuscation context is null
|
||||
if (environment.getObfuscationContext() == null)
|
||||
{
|
||||
environment.setObfuscationContext("notch");
|
||||
}
|
||||
|
||||
// This is a client side, client :)
|
||||
environment.setSide(MixinEnvironment.Side.CLIENT);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLaunchTarget()
|
||||
{
|
||||
Client.logger.info("Silent Client Tweak Loader: Launch target");
|
||||
return MixinBootstrap.getPlatform().getLaunchTarget();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getLaunchArguments()
|
||||
{
|
||||
Client.logger.info("Silent Client Tweak Loader: Launch Args");
|
||||
return launchArgs.toArray(new String[0]);
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,5 @@ public interface MinecraftAccessor {
|
||||
@Accessor
|
||||
void setLeftClickCounter(int a);
|
||||
|
||||
@Accessor
|
||||
int getLeftClickCounter();
|
||||
|
||||
@Accessor boolean isRunning();
|
||||
}
|
||||
|
@ -1,9 +0,0 @@
|
||||
package net.silentclient.client.mixin.ducks;
|
||||
|
||||
import net.silentclient.client.mixin.wrappers.IMetadataSerializerWrapper;
|
||||
import net.silentclient.client.mixin.wrappers.TextureManagerWrapper;
|
||||
|
||||
public interface MinecraftExt {
|
||||
TextureManagerWrapper silent$getRenderEngine();
|
||||
IMetadataSerializerWrapper silent$getMetadataSerializer_();
|
||||
}
|
@ -5,6 +5,7 @@ import net.minecraft.client.entity.EntityPlayerSP;
|
||||
import net.minecraft.client.renderer.EntityRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
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.Client;
|
||||
@ -54,6 +55,37 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
||||
GlStateManager.rotate(event.getRoll(), 0, 0, 1);
|
||||
}
|
||||
|
||||
private float eyeHeightSubtractor;
|
||||
private long lastEyeHeightUpdate;
|
||||
|
||||
@Redirect(method = "orientCamera", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/Entity;getEyeHeight()F"))
|
||||
public float orientCamera(Entity entity) {
|
||||
if(Client.getInstance().getModInstances().getModByClass(AnimationsMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "Smooth Sneaking").getValBoolean() && entity instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
float height = player.getEyeHeight();
|
||||
if(player.isSneaking()) {
|
||||
height += 0.08F;
|
||||
}
|
||||
float actualEyeHeightSubtractor = player.isSneaking() ? 0.08F : 0;
|
||||
long sinceLastUpdate = System.currentTimeMillis() - lastEyeHeightUpdate;
|
||||
lastEyeHeightUpdate = System.currentTimeMillis();
|
||||
if(actualEyeHeightSubtractor > eyeHeightSubtractor) {
|
||||
eyeHeightSubtractor += sinceLastUpdate / 500f;
|
||||
if(actualEyeHeightSubtractor < eyeHeightSubtractor) {
|
||||
eyeHeightSubtractor = actualEyeHeightSubtractor;
|
||||
}
|
||||
}
|
||||
else if(actualEyeHeightSubtractor < eyeHeightSubtractor) {
|
||||
eyeHeightSubtractor -= sinceLastUpdate / 500f;
|
||||
if(actualEyeHeightSubtractor > eyeHeightSubtractor) {
|
||||
eyeHeightSubtractor = actualEyeHeightSubtractor;
|
||||
}
|
||||
}
|
||||
return height - eyeHeightSubtractor;
|
||||
}
|
||||
return entity.getEyeHeight();
|
||||
}
|
||||
|
||||
@Redirect(method = "orientCamera", at = @At(value = "FIELD", target = "Lnet/minecraft/entity/Entity;rotationYaw:F"))
|
||||
public float getRotationYaw(Entity entity) {
|
||||
return rotationYaw;
|
||||
@ -121,11 +153,11 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
||||
cir.setReturnValue(event.getFov());
|
||||
}
|
||||
|
||||
@Redirect(method = "setupCameraTransform", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/EntityRenderer;hurtCameraEffect(F)V"))
|
||||
public void cancelWorldRotation(EntityRenderer entityRenderer, float f) {
|
||||
if(!(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "No Shaking").getValBoolean())) {
|
||||
this.hurtCameraEffect(f);
|
||||
@Inject(method = "hurtCameraEffect", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/util/MathHelper;sin(F)F"), cancellable = true)
|
||||
public void cancelWorldRotation(float partialTicks, CallbackInfo ci) {
|
||||
if(Client.getInstance().getModInstances().getOldAnimationsMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(AnimationsMod.class, "No Shaking").getValBoolean()) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,9 +16,6 @@ import net.silentclient.client.event.impl.EventDebugFps;
|
||||
import net.silentclient.client.event.impl.EventScrollMouse;
|
||||
import net.silentclient.client.gui.GuiNews;
|
||||
import net.silentclient.client.gui.util.BackgroundPanorama;
|
||||
import net.silentclient.client.mixin.ducks.MinecraftExt;
|
||||
import net.silentclient.client.mixin.wrappers.IMetadataSerializerWrapper;
|
||||
import net.silentclient.client.mixin.wrappers.TextureManagerWrapper;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.LWJGLException;
|
||||
@ -35,7 +32,7 @@ import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(Minecraft.class)
|
||||
public abstract class MinecraftMixin implements MinecraftExt {
|
||||
public abstract class MinecraftMixin {
|
||||
@Inject(method = "startGame", at = @At("HEAD"))
|
||||
public void initClient(CallbackInfo callbackInfo) {
|
||||
Client.getInstance().init();
|
||||
@ -43,6 +40,7 @@ public abstract class MinecraftMixin implements MinecraftExt {
|
||||
|
||||
@Inject(method = "startGame", at = @At("TAIL"))
|
||||
public void startClient(CallbackInfo callbackInfo) throws Throwable {
|
||||
Client.getInstance().setiMetadataSerializer(this.metadataSerializer_);
|
||||
Client.getInstance().start();
|
||||
}
|
||||
|
||||
@ -59,16 +57,6 @@ public abstract class MinecraftMixin implements MinecraftExt {
|
||||
Client.getInstance().shutdown();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMetadataSerializerWrapper silent$getMetadataSerializer_() {
|
||||
return new IMetadataSerializerWrapper(this.metadataSerializer_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureManagerWrapper silent$getRenderEngine() {
|
||||
return new TextureManagerWrapper(this.renderEngine);
|
||||
}
|
||||
|
||||
@Redirect(method = "createDisplay", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;setTitle(Ljava/lang/String;)V"))
|
||||
public void setWindowTitle(String newTitle) {
|
||||
Display.setTitle("Silent Client " + Client.getInstance().getVersion() + " (1.8.9)");
|
||||
@ -88,11 +76,9 @@ public abstract class MinecraftMixin implements MinecraftExt {
|
||||
|
||||
@Shadow private static int debugFPS;
|
||||
|
||||
@Shadow @Final private IMetadataSerializer metadataSerializer_;
|
||||
|
||||
@Shadow public abstract TextureManager getTextureManager();
|
||||
|
||||
@Shadow private TextureManager renderEngine;
|
||||
@Shadow @Final private IMetadataSerializer metadataSerializer_;
|
||||
|
||||
@Inject(method = "displayGuiScreen", at = @At("RETURN"), cancellable = true)
|
||||
public void displayGuiScreenInject(GuiScreen guiScreenIn, CallbackInfo ci) {
|
||||
|
@ -1,15 +0,0 @@
|
||||
package net.silentclient.client.mixin.wrappers;
|
||||
|
||||
import net.minecraft.client.resources.data.IMetadataSerializer;
|
||||
|
||||
public class IMetadataSerializerWrapper {
|
||||
private final IMetadataSerializer iMetadataSerializer;
|
||||
|
||||
public IMetadataSerializerWrapper(IMetadataSerializer iMetadataSerializer) {
|
||||
this.iMetadataSerializer = iMetadataSerializer;
|
||||
}
|
||||
|
||||
public IMetadataSerializer getiMetadataSerializer() {
|
||||
return iMetadataSerializer;
|
||||
}
|
||||
}
|
@ -1,15 +0,0 @@
|
||||
package net.silentclient.client.mixin.wrappers;
|
||||
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
|
||||
public class TextureManagerWrapper {
|
||||
private final TextureManager textureManager;
|
||||
|
||||
public TextureManagerWrapper(TextureManager textureManager) {
|
||||
this.textureManager = textureManager;
|
||||
}
|
||||
|
||||
public TextureManager getTextureManager() {
|
||||
return textureManager;
|
||||
}
|
||||
}
|
@ -6,7 +6,6 @@ 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.mixin.ducks.MinecraftExt;
|
||||
import net.silentclient.client.mods.Mod;
|
||||
import net.silentclient.client.mods.ModCategory;
|
||||
|
||||
@ -41,7 +40,7 @@ public class AnimationsMod extends Mod {
|
||||
GlStateManager.depthFunc(514);
|
||||
GlStateManager.disableLighting();
|
||||
GlStateManager.blendFunc(768, 1);
|
||||
((MinecraftExt) Minecraft.getMinecraft()).silent$getRenderEngine().getTextureManager().bindTexture(RES_ITEM_GLINT);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(RES_ITEM_GLINT);
|
||||
GlStateManager.matrixMode(5890);
|
||||
|
||||
GlStateManager.pushMatrix();
|
||||
@ -63,7 +62,7 @@ public class AnimationsMod extends Mod {
|
||||
GlStateManager.enableLighting();
|
||||
GlStateManager.depthFunc(515);
|
||||
GlStateManager.depthMask(true);
|
||||
((MinecraftExt) Minecraft.getMinecraft()).silent$getRenderEngine().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6,10 +6,10 @@ import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.shader.ShaderGroup;
|
||||
import net.minecraft.client.util.JsonException;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.event.EventTarget;
|
||||
import net.silentclient.client.event.impl.ClientTickEvent;
|
||||
import net.silentclient.client.mixin.accessors.SimpleReloadableResourceManagerAccessor;
|
||||
import net.silentclient.client.mixin.ducks.MinecraftExt;
|
||||
import net.silentclient.client.mods.Mod;
|
||||
import net.silentclient.client.mods.ModCategory;
|
||||
import net.silentclient.client.mods.Setting;
|
||||
@ -56,7 +56,7 @@ public class ColorSaturationMod extends Mod {
|
||||
@EventTarget
|
||||
public void tick(ClientTickEvent event) {
|
||||
if (this.domainResourceManagers != null && !this.domainResourceManagers.containsKey("colorsaturation")) {
|
||||
this.domainResourceManagers.put("colorsaturation", new SaturationResourceManager(((MinecraftExt) this.mc).silent$getMetadataSerializer_().getiMetadataSerializer()));
|
||||
this.domainResourceManagers.put("colorsaturation", new SaturationResourceManager(Client.getInstance().getiMetadataSerializer()));
|
||||
}
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ public class ColorSaturationMod extends Mod {
|
||||
this.domainResourceManagers.remove("colorsaturation");
|
||||
}
|
||||
if (this.domainResourceManagers != null && !this.domainResourceManagers.containsKey("colorsaturation")) {
|
||||
this.domainResourceManagers.put("colorsaturation", new SaturationResourceManager(((MinecraftExt) this.mc).silent$getMetadataSerializer_().getiMetadataSerializer()));
|
||||
this.domainResourceManagers.put("colorsaturation", new SaturationResourceManager(Client.getInstance().getiMetadataSerializer()));
|
||||
}
|
||||
shader = null;
|
||||
}
|
||||
@ -82,7 +82,7 @@ public class ColorSaturationMod extends Mod {
|
||||
this.domainResourceManagers.remove("colorsaturation");
|
||||
}
|
||||
if (this.domainResourceManagers != null && !this.domainResourceManagers.containsKey("colorsaturation")) {
|
||||
this.domainResourceManagers.put("colorsaturation", new SaturationResourceManager(((MinecraftExt) this.mc).silent$getMetadataSerializer_().getiMetadataSerializer()));
|
||||
this.domainResourceManagers.put("colorsaturation", new SaturationResourceManager(Client.getInstance().getiMetadataSerializer()));
|
||||
}
|
||||
try {
|
||||
this.shader = new ShaderGroup(mc.getTextureManager(), mc.getResourceManager(), mc.getFramebuffer(),
|
||||
|
@ -1,8 +1,5 @@
|
||||
{
|
||||
"required": true,
|
||||
"compatibilityLevel": "JAVA_8",
|
||||
"verbose": true,
|
||||
"minVersion": "0.6",
|
||||
"package": "net.silentclient.client.mixin",
|
||||
"refmap": "mixins.SilentClient.refmap.json",
|
||||
"mixins": [
|
||||
@ -39,6 +36,7 @@
|
||||
"mixins.RenderItemMixin",
|
||||
"mixins.ModelBipedMixin",
|
||||
"mixins.LoadingScreenRendererMixin",
|
||||
"accessors.MinecraftAccessor"
|
||||
"accessors.MinecraftAccessor",
|
||||
"accessors.ItemFoodAccessor"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user