Fixes
This commit is contained in:
parent
a1a2cf60c9
commit
fc48f1507a
|
@ -7,10 +7,11 @@ import org.lwjgl.opengl.DisplayMode;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mods.settings.RenderMod;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
public class MinecraftHook {
|
||||
|
||||
public static void displayFix(boolean fullscreen, int displayWidth, int displayHeight) throws LWJGLException {
|
||||
public static void displayFix(CallbackInfo ci, boolean fullscreen, int displayWidth, int displayHeight) throws LWJGLException {
|
||||
Display.setFullscreen(false);
|
||||
if (fullscreen) {
|
||||
if (Client.getInstance().getModInstances() != null && RenderMod.isBorderlessFullScreen()) {
|
||||
|
|
|
@ -18,6 +18,7 @@ import net.silentclient.client.event.impl.EventZoomFov;
|
|||
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.animations.OldSneaking;
|
||||
import net.silentclient.client.utils.culling.EntityCulling;
|
||||
import net.silentclient.client.utils.shader.MotionBlurUtils;
|
||||
|
@ -140,6 +141,8 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
|||
|
||||
@Shadow private boolean useShader;
|
||||
|
||||
@Shadow protected abstract void setupViewBobbing(float partialTicks);
|
||||
|
||||
@Override
|
||||
public void silent$loadShader(StaticResourceLocation location) {
|
||||
this.loadShader(location.getLocation());
|
||||
|
@ -171,6 +174,13 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
|||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "setupCameraTransform", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/EntityRenderer;setupViewBobbing(F)V"))
|
||||
public void modelBobbing(EntityRenderer instance, float f) {
|
||||
if(!Client.getInstance().getSettingsManager().getSettingByClass(RenderMod.class, "Model Bobbing Only").getValBoolean()) {
|
||||
this.setupViewBobbing(f);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "updateCameraAndRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/shader" + "/Framebuffer;bindFramebuffer(Z)V", shift = At.Shift.BEFORE))
|
||||
public void updateCameraAndRender(float partialTicks, long nanoTime, CallbackInfo ci) {
|
||||
ShaderGroup colorSaturation = Client.getInstance().getModInstances().getColorSaturation().getShader();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.silentclient.client.Client;
|
||||
|
@ -8,12 +9,13 @@ import net.silentclient.client.cosmetics.StaticResourceLocation;
|
|||
import net.silentclient.client.mixin.ducks.EntityRendererExt;
|
||||
import net.silentclient.client.mods.render.InventoryBlurMod;
|
||||
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.CallbackInfo;
|
||||
|
||||
@Mixin(GuiContainer.class)
|
||||
public class GuiContainerMixin {
|
||||
public abstract class GuiContainerMixin extends GuiScreen {
|
||||
@Inject(method = "initGui", at = @At("HEAD"))
|
||||
public void onOpenBlur(CallbackInfo ci) {
|
||||
if(Client.getInstance().getModInstances().getModByClass(InventoryBlurMod.class).isEnabled()) {
|
||||
|
@ -27,4 +29,20 @@ public class GuiContainerMixin {
|
|||
Minecraft.getMinecraft().entityRenderer.loadEntityShader(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
|
||||
private void checkCloseClick(int mouseX, int mouseY, int mouseButton, CallbackInfo ci) {
|
||||
if (mouseButton - 100 == mc.gameSettings.keyBindInventory.getKeyCode()) {
|
||||
mc.thePlayer.closeScreen();
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Shadow
|
||||
protected abstract boolean checkHotbarKeys(int keyCode);
|
||||
|
||||
@Inject(method = "mouseClicked", at = @At("TAIL"))
|
||||
private void patcher$checkHotbarClicks(int mouseX, int mouseY, int mouseButton, CallbackInfo ci) {
|
||||
checkHotbarKeys(mouseButton - 100);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,33 @@
|
|||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Gui;
|
||||
import net.minecraft.client.gui.GuiIngame;
|
||||
import net.minecraft.client.gui.ScaledResolution;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.event.impl.EventRenderDamageTint;
|
||||
import net.silentclient.client.event.impl.RenderEvent;
|
||||
import net.silentclient.client.gui.clickgui.utils.GlUtils;
|
||||
import net.silentclient.client.mods.hud.BossBarMod;
|
||||
import net.silentclient.client.mods.render.CrosshairMod;
|
||||
import net.silentclient.client.mods.settings.RenderMod;
|
||||
import net.silentclient.client.utils.ColorUtils;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GuiIngame.class)
|
||||
public abstract class GuiInGameMixin {
|
||||
public abstract class GuiInGameMixin extends Gui {
|
||||
@Shadow @Final private Minecraft mc;
|
||||
|
||||
@Inject(method = "renderGameOverlay", at = @At("RETURN"))
|
||||
public void renderEvent(float partialTicks, CallbackInfo ci) {
|
||||
GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
@ -35,4 +48,39 @@ public abstract class GuiInGameMixin {
|
|||
public void customBossBar(GuiIngame instance) {
|
||||
BossBarMod.renderBossHealth(instance);
|
||||
}
|
||||
|
||||
@Redirect(method = "renderGameOverlay", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiIngame;showCrosshair()Z"))
|
||||
public boolean renderCrosshair(GuiIngame instance) {
|
||||
if(!(Client.getInstance().getSettingsManager().getSettingByClass(RenderMod.class, "Crosshair in F5").getValBoolean() || this.mc.gameSettings.thirdPersonView < 1)) {
|
||||
return false;
|
||||
}
|
||||
ScaledResolution scaledresolution = new ScaledResolution(this.mc);
|
||||
int x = scaledresolution.getScaledWidth();
|
||||
int y = scaledresolution.getScaledHeight();
|
||||
if(!Client.getInstance().getModInstances().getModByClass(CrosshairMod.class).isEnabled()) {
|
||||
GlStateManager.tryBlendFuncSeparate(775, 769, 1, 0);
|
||||
GlStateManager.enableAlpha();
|
||||
this.drawTexturedModalRect(x / 2 - 7, y / 2 - 7, 0, 0, 16, 16);
|
||||
} else {
|
||||
if(Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset Crosshair").getValBoolean()) {
|
||||
String selected = Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Preset ID").getValString();
|
||||
if(Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Vanilla Blendering").getValBoolean()) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(775, 769, 1, 0);
|
||||
GlStateManager.enableAlpha();
|
||||
GlStateManager.enableDepth();
|
||||
} else {
|
||||
ColorUtils.setColor(Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Crosshair Color").getValColor().getRGB());
|
||||
}
|
||||
|
||||
mc.getTextureManager().bindTexture(new ResourceLocation("silentclient/mods/crosshair/crosshair" + selected + ".png"));
|
||||
GlUtils.startScale(x / 2 - 7, y / 2 - 7, 16, 16, (float) Client.getInstance().getSettingsManager().getSettingByClass(CrosshairMod.class, "Scale").getValDouble());
|
||||
Gui.drawModalRectWithCustomSizedTexture(x / 2 - 7, y / 2 - 7, 0, 0, 16, 16, 16, 16);
|
||||
GlUtils.stopScale();
|
||||
this.mc.getTextureManager().bindTexture(icons);
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.renderer.InventoryEffectRenderer;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mods.hud.PotionHudMod;
|
||||
import net.silentclient.client.mods.settings.RenderMod;
|
||||
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;
|
||||
|
||||
@Mixin(InventoryEffectRenderer.class)
|
||||
public abstract class InventoryEffectRendererMixin extends GuiContainer {
|
||||
public InventoryEffectRendererMixin(Container inventorySlotsIn) {
|
||||
super(inventorySlotsIn);
|
||||
}
|
||||
|
||||
@Shadow private boolean hasActivePotionEffects;
|
||||
|
||||
/**
|
||||
* @author kirillsaint
|
||||
* @reason custom effects update
|
||||
*/
|
||||
@Overwrite
|
||||
public void updateActivePotionEffects()
|
||||
{
|
||||
if (!Minecraft.getMinecraft().thePlayer.getActivePotionEffects().isEmpty() && (!Client.getInstance().getModInstances().getPotionHudMod().isEnabled() || Client.getInstance().getModInstances().getPotionHudMod().isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(PotionHudMod.class, "Potions In Inventory").getValBoolean()))
|
||||
{
|
||||
if(Client.getInstance().getSettingsManager().getSettingByClass(RenderMod.class, "Centered Potion Inventory").getValBoolean()) {
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
} else {
|
||||
this.guiLeft = 160 + (this.width - this.xSize - 200) / 2;
|
||||
}
|
||||
this.hasActivePotionEffects = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.guiLeft = (this.width - this.xSize) / 2;
|
||||
this.hasActivePotionEffects = false;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -14,6 +14,7 @@ import net.silentclient.client.Client;
|
|||
import net.silentclient.client.event.impl.*;
|
||||
import net.silentclient.client.gui.GuiNews;
|
||||
import net.silentclient.client.gui.util.BackgroundPanorama;
|
||||
import net.silentclient.client.hooks.MinecraftHook;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.LWJGLException;
|
||||
|
@ -87,6 +88,12 @@ public abstract class MinecraftMixin {
|
|||
|
||||
@Shadow @Final private IMetadataSerializer metadataSerializer_;
|
||||
|
||||
@Shadow private boolean fullscreen;
|
||||
|
||||
@Shadow public int displayWidth;
|
||||
|
||||
@Shadow public int displayHeight;
|
||||
|
||||
@Inject(method = "displayGuiScreen", at = @At("RETURN"), cancellable = true)
|
||||
public void displayGuiScreenInject(GuiScreen guiScreenIn, CallbackInfo ci) {
|
||||
if(Client.backgroundPanorama == null) {
|
||||
|
@ -167,4 +174,14 @@ public abstract class MinecraftMixin {
|
|||
EventScrollMouse event = new EventScrollMouse(dWheel);
|
||||
event.call();
|
||||
}
|
||||
|
||||
@Inject(method = "setInitialDisplayMode", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void setInitialDisplayMode(CallbackInfo ci) throws LWJGLException {
|
||||
MinecraftHook.displayFix(ci, fullscreen, displayWidth, displayHeight);
|
||||
}
|
||||
|
||||
@Inject(method = "toggleFullscreen", at = @At(value = "INVOKE", remap = false, target = "Lorg/lwjgl/opengl/Display;setVSyncEnabled(Z)V", shift = At.Shift.AFTER))
|
||||
private void toggleFullscreen(CallbackInfo ci) throws LWJGLException {
|
||||
MinecraftHook.fullScreenFix(fullscreen, displayWidth, displayHeight);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
"accessors.ItemFoodAccessor",
|
||||
"mixins.BlockGlassMixin",
|
||||
"mixins.ShaderGroupMixin",
|
||||
"mixins.GuiContainerMixin"
|
||||
"mixins.GuiContainerMixin",
|
||||
"mixins.InventoryEffectRendererMixin"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue