Pack Tweaks Mod

This commit is contained in:
kirillsaint 2023-07-01 21:49:42 +06:00
parent 914892a19a
commit a6d5310e96
2 changed files with 55 additions and 0 deletions

View File

@ -14,6 +14,7 @@ import net.silentclient.client.gui.clickgui.utils.GlUtils;
import net.silentclient.client.mods.hud.BossBarMod;
import net.silentclient.client.mods.hud.ScoreboardMod;
import net.silentclient.client.mods.render.CrosshairMod;
import net.silentclient.client.mods.render.PackTweaksMod;
import net.silentclient.client.mods.settings.RenderMod;
import net.silentclient.client.utils.ColorUtils;
import net.silentclient.client.utils.HUDCaching;
@ -100,4 +101,11 @@ public abstract class GuiInGameMixin extends Gui {
ci.cancel();
}
}
@Inject(method = "renderPumpkinOverlay", at = @At("HEAD"), cancellable = true)
public void cancelPumpkin(ScaledResolution scaledRes, CallbackInfo ci) {
if(Client.getInstance().getModInstances().getModByClass(PackTweaksMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(PackTweaksMod.class, "Hide Pumpkin Overlay").getValBoolean()) {
ci.cancel();
}
}
}

View File

@ -1,9 +1,14 @@
package net.silentclient.client.mixin.mixins;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.ItemRenderer;
import net.minecraft.item.ItemStack;
import net.silentclient.client.Client;
import net.silentclient.client.event.impl.EventTransformFirstPersonItem;
import net.silentclient.client.mods.render.PackTweaksMod;
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.injection.At;
@ -18,6 +23,8 @@ public class ItemRendererMixin {
@Shadow private float equippedProgress;
@Shadow @Final private Minecraft mc;
@Inject(method = "transformFirstPersonItem", at = @At("HEAD"))
public void transformFirstPersonItem(float equipProgress, float swingProgress, CallbackInfo ci) {
EventTransformFirstPersonItem event = new EventTransformFirstPersonItem(itemToRender, equipProgress, swingProgress);
@ -34,4 +41,44 @@ public class ItemRendererMixin {
}
}
}
@Inject(method = "renderWaterOverlayTexture", at = @At("HEAD"), cancellable = true)
public void cancelWaterOverlay(float partialTicks, CallbackInfo ci) {
if (Client.getInstance().getModInstances().getModByClass(PackTweaksMod.class).isEnabled() && Client.getInstance().getSettingsManager().getSettingByClass(PackTweaksMod.class, "Water Fog").getValBoolean() == false) {
ci.cancel();
}
}
@Inject(method = "renderFireInFirstPerson", at = @At("HEAD"), cancellable = true)
private void silent$changeHeightAndFixOverlay(CallbackInfo ci) {
if (this.mc.getTextureMapBlocks().getAtlasSprite("minecraft:blocks/fire_layer_1").getFrameCount() == 0) {
ci.cancel();
return;
}
GlStateManager.pushMatrix();
boolean tweaked = Client.getInstance().getModInstances().getModByClass(PackTweaksMod.class).isEnabled();
if(tweaked) {
GlStateManager.translate(0, Client.getInstance().getSettingsManager().getSettingByClass(PackTweaksMod.class, "Fire Height").getValFloat(), 0);
}
}
@Inject(method = "renderFireInFirstPerson", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;pushMatrix()V", shift = At.Shift.AFTER))
private void silent$enableFireOpacity(CallbackInfo ci) {
boolean tweaked = Client.getInstance().getModInstances().getModByClass(PackTweaksMod.class).isEnabled();
float fireOpacity = Client.getInstance().getSettingsManager().getSettingByClass(PackTweaksMod.class, "Fire Opacity").getValFloat();
if(fireOpacity != 1 && tweaked) {
GlStateManager.color(1, 1, 1, fireOpacity);
}
}
@Inject(method = "renderFireInFirstPerson", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/GlStateManager;popMatrix()V"))
private void silent$disableFireOpacity(CallbackInfo ci) {
GlStateManager.color(1, 1, 1, 1);
}
@Inject(method = "renderFireInFirstPerson", at = @At("TAIL"))
private void silent$popMatrix(CallbackInfo ci) {
GlStateManager.popMatrix();
}
}