mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:11:31 +01:00
Optimization
This commit is contained in:
parent
1a5567b15b
commit
07ecc8a906
@ -0,0 +1,5 @@
|
||||
package net.silentclient.client.mixin.ducks;
|
||||
|
||||
public interface GameSettingsExt {
|
||||
void silent$onSettingsGuiClosed();
|
||||
}
|
@ -0,0 +1,14 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.BlockFluidRenderer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.Constant;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||
|
||||
@Mixin(BlockFluidRenderer.class)
|
||||
public class BlockFluidRendererMixin {
|
||||
@ModifyConstant(method = "renderFluid", constant = @Constant(floatValue = 0.001F))
|
||||
private float silent$fixFluidStitching(float original) {
|
||||
return 0.0F;
|
||||
}
|
||||
}
|
@ -0,0 +1,34 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(targets = "net.minecraft.client.renderer.BlockModelRenderer$AmbientOcclusionFace")
|
||||
public class BlockModelRendererAmbientOcclusionFaceMixin {
|
||||
@Redirect(
|
||||
//#if MC==10809
|
||||
method = "updateVertexBrightness(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/block/Block;Lnet/minecraft/util/BlockPos;Lnet/minecraft/util/EnumFacing;[FLjava/util/BitSet;)V",
|
||||
//#else
|
||||
//$$ method = "(Lnet/minecraft/world/IBlockAccess;Lnet/minecraft/block/state/IBlockState;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/EnumFacing;[FLjava/util/BitSet;)V",
|
||||
//#endif
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target =
|
||||
//#if MC==10809
|
||||
"Lnet/minecraft/block/Block;isTranslucent()Z"
|
||||
//#else
|
||||
//$$ "Lnet/minecraft/block/Block;isTranslucent(Lnet/minecraft/block/state/IBlockState;)Z"
|
||||
//#endif
|
||||
)
|
||||
)
|
||||
private boolean patcher$betterSmoothLighting(Block block) {
|
||||
//#if MC==10809
|
||||
return !block.isVisuallyOpaque() || block.getLightOpacity() == 0;
|
||||
//#else
|
||||
//$$ IBlockState state = block.getDefaultState();
|
||||
//$$ return !block.causesSuffocation(state) || block.getLightOpacity(state) == 0;
|
||||
//#endif
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.block.BlockRedstoneTorch;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.WeakHashMap;
|
||||
|
||||
@Mixin(BlockRedstoneTorch.class)
|
||||
public class BlockRedstoneTorchMixin {
|
||||
//#if MC==10809
|
||||
@Shadow private static Map<World, List<BlockRedstoneTorch.Toggle>> toggles = new WeakHashMap<>();
|
||||
//#endif
|
||||
}
|
@ -0,0 +1,25 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.play.INetHandlerPlayServer;
|
||||
import net.minecraft.network.play.client.C17PacketCustomPayload;
|
||||
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(C17PacketCustomPayload.class)
|
||||
public class C17PacketCustomPayloadMixin {
|
||||
//#if MC==10809
|
||||
@Shadow
|
||||
private PacketBuffer data;
|
||||
|
||||
@Inject(method = "processPacket(Lnet/minecraft/network/play/INetHandlerPlayServer;)V", at = @At("TAIL"))
|
||||
private void patcher$releaseData(INetHandlerPlayServer handler, CallbackInfo ci) {
|
||||
if (this.data != null) {
|
||||
this.data.release();
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.command.CommandHandler;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
@Mixin(CommandHandler.class)
|
||||
public class CommandHandlerMixin {
|
||||
@ModifyArg(method = {"executeCommand", "getTabCompletionOptions"}, at = @At(value = "INVOKE", target = "Ljava/util/Map;get(Ljava/lang/Object;)Ljava/lang/Object;", remap = false))
|
||||
private Object silent$makeLowerCaseForGet(Object s) {
|
||||
if (s instanceof String) {
|
||||
return ((String) s).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "registerCommand", at = @At(value = "INVOKE", target = "Ljava/util/Map;put(Ljava/lang/Object;Ljava/lang/Object;)Ljava/lang/Object;", remap = false), index = 0)
|
||||
private Object silent$makeLowerCaseForPut(Object s) {
|
||||
if (s instanceof String) {
|
||||
return ((String) s).toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
return s;
|
||||
}
|
||||
|
||||
@ModifyArg(method = "getTabCompletionOptions", at = @At(value = "INVOKE", target = "Lnet/minecraft/command/CommandBase;doesStringStartWith(Ljava/lang/String;Ljava/lang/String;)Z"), index = 0)
|
||||
private String silent$makeLowerCaseForTabComplete(String s) {
|
||||
return s != null ? s.toLowerCase(Locale.ENGLISH) : null;
|
||||
}
|
||||
}
|
@ -0,0 +1,32 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import java.util.Iterator;
|
||||
|
||||
//#if MC==11202
|
||||
//$$ import net.minecraft.potion.Potion;
|
||||
//#endif
|
||||
|
||||
@Mixin(EntityLivingBase.class)
|
||||
public class EntityLivingBaseMixin {
|
||||
@Inject(method = "updatePotionEffects", at = @At(value = "INVOKE", target = "Lnet/minecraft/potion/PotionEffect;onUpdate(Lnet/minecraft/entity/EntityLivingBase;)Z"),
|
||||
locals = LocalCapture.CAPTURE_FAILSOFT, cancellable = true)
|
||||
private void patcher$checkPotionEffect(CallbackInfo ci,
|
||||
//#if MC==10809
|
||||
Iterator<Integer> iterator, Integer integer,
|
||||
//#else
|
||||
//$$ Iterator<Potion> iterator, Potion potion,
|
||||
//#endif
|
||||
PotionEffect potioneffect) {
|
||||
if (potioneffect == null) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
@ -2,19 +2,23 @@ package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.event.HoverEvent;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.util.ChatStyle;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraft.world.World;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(Entity.class)
|
||||
public abstract class EntityMixin {
|
||||
@Shadow protected abstract HoverEvent getHoverEvent();
|
||||
|
||||
@Shadow public boolean onGround;
|
||||
private long silent$displayNameCachedAt;
|
||||
|
||||
private IChatComponent silent$cachedDisplayName;
|
||||
@ -43,4 +47,14 @@ public abstract class EntityMixin {
|
||||
// Let's not set it to null...
|
||||
return null;
|
||||
}
|
||||
|
||||
@Redirect(method = "getBrightnessForRender", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;isBlockLoaded(Lnet/minecraft/util/BlockPos;)Z"))
|
||||
public boolean silent$alwaysReturnTrue(World world, BlockPos pos) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Inject(method = "spawnRunningParticles", at = @At("HEAD"), cancellable = true)
|
||||
private void silent$checkGroundState(CallbackInfo ci) {
|
||||
if (!this.onGround) ci.cancel();
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ 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.Slice;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@ -239,4 +240,32 @@ public abstract class EntityRendererMixin implements EntityRendererExt {
|
||||
ci.cancel();
|
||||
}
|
||||
//#endif
|
||||
|
||||
@Inject(
|
||||
method = "renderWorldPass",
|
||||
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/util/EnumWorldBlockLayer;TRANSLUCENT:Lnet/minecraft/util/EnumWorldBlockLayer;")),
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/RenderGlobal;renderBlockLayer(Lnet/minecraft/util/EnumWorldBlockLayer;DILnet/minecraft/entity/Entity;)I",
|
||||
ordinal = 0
|
||||
)
|
||||
)
|
||||
private void silent$enablePolygonOffset(CallbackInfo ci) {
|
||||
GlStateManager.enablePolygonOffset();
|
||||
GlStateManager.doPolygonOffset(-0.325F, -0.325F);
|
||||
}
|
||||
|
||||
@Inject(
|
||||
method = "renderWorldPass",
|
||||
slice = @Slice(from = @At(value = "FIELD", target = "Lnet/minecraft/util/EnumWorldBlockLayer;TRANSLUCENT:Lnet/minecraft/util/EnumWorldBlockLayer;")),
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/RenderGlobal;renderBlockLayer(Lnet/minecraft/util/EnumWorldBlockLayer;DILnet/minecraft/entity/Entity;)I",
|
||||
ordinal = 0,
|
||||
shift = At.Shift.AFTER
|
||||
)
|
||||
)
|
||||
private void silent$disablePolygonOffset(CallbackInfo ci) {
|
||||
GlStateManager.disablePolygonOffset();
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,17 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.entity.item.EntityXPOrb;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(EntityXPOrb.class)
|
||||
public class EntityXPOrbMixin {
|
||||
//#if MC==10809
|
||||
@Redirect(method = "onUpdate", at = @At(value = "INVOKE", target = "Lnet/minecraft/entity/player/EntityPlayer;getEyeHeight()F"))
|
||||
private float patcher$lowerHeight(EntityPlayer entityPlayer) {
|
||||
return (float) (entityPlayer.getEyeHeight() / 2.0D);
|
||||
}
|
||||
//#endif
|
||||
}
|
@ -3,13 +3,14 @@ package net.silentclient.client.mixin.mixins;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.silentclient.client.event.impl.EventText;
|
||||
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.ModifyVariable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(value = FontRenderer.class, priority = 1100)
|
||||
public class FontRendererMixin {
|
||||
public abstract class FontRendererMixin {
|
||||
@ModifyVariable(method = "renderString", at = @At("HEAD"), ordinal = 0)
|
||||
public String renderString(String text) {
|
||||
if(text == null) {
|
||||
@ -33,4 +34,17 @@ public class FontRendererMixin {
|
||||
|
||||
return event.getOutputText();
|
||||
}
|
||||
|
||||
@Shadow
|
||||
protected abstract void resetStyles();
|
||||
|
||||
@Inject(method = "drawString(Ljava/lang/String;FFIZ)I",
|
||||
at = @At(
|
||||
value = "INVOKE", target = "Lnet/minecraft/client/gui/FontRenderer;renderString(Ljava/lang/String;FFIZ)I",
|
||||
ordinal = 0, shift = At.Shift.AFTER
|
||||
)
|
||||
)
|
||||
private void silent$resetStyle(CallbackInfoReturnable<Integer> ci) {
|
||||
this.resetStyles();
|
||||
}
|
||||
}
|
||||
|
@ -1,17 +1,63 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import com.google.common.util.concurrent.ListenableFuture;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.keybinds.KeyBindManager;
|
||||
import net.silentclient.client.mixin.ducks.GameSettingsExt;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
import org.lwjgl.input.Mouse;
|
||||
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(GameSettings.class)
|
||||
public class GameSettingsMixin {
|
||||
public class GameSettingsMixin implements GameSettingsExt {
|
||||
@Shadow protected Minecraft mc;
|
||||
private boolean silent$needsResourceRefresh;
|
||||
|
||||
@Override
|
||||
public void silent$onSettingsGuiClosed() {
|
||||
if (silent$needsResourceRefresh) {
|
||||
mc.scheduleResourcesRefresh();
|
||||
silent$needsResourceRefresh = false;
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC==10809
|
||||
@Redirect(
|
||||
method = "setOptionFloatValue",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/Minecraft;scheduleResourcesRefresh()Lcom/google/common/util/concurrent/ListenableFuture;")
|
||||
)
|
||||
private ListenableFuture<Object> silent$scheduleResourceRefresh(Minecraft instance) {
|
||||
silent$needsResourceRefresh = true;
|
||||
return null;
|
||||
}
|
||||
//#endif
|
||||
|
||||
@Redirect(method = "<init>(Lnet/minecraft/client/Minecraft;Ljava/io/File;)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/settings/GameSettings;loadOptions()V"))
|
||||
private void loadKeyBindManager(GameSettings instance) {
|
||||
Client.getInstance().setKeyBindManager(new KeyBindManager(instance));
|
||||
instance.loadOptions();
|
||||
}
|
||||
|
||||
//#if MC==10809
|
||||
/**
|
||||
* @author asbyth
|
||||
* @reason Resolve Chat Key bound to a unicode char causing crashes while creative inventory is opened (MC-102867)
|
||||
*/
|
||||
@Overwrite
|
||||
public static boolean isKeyDown(KeyBinding key) {
|
||||
int keyCode = key.getKeyCode();
|
||||
if (keyCode != 0 && keyCode < 256) {
|
||||
return keyCode < 0 ? Mouse.isButtonDown(keyCode + 100) : Keyboard.isKeyDown(keyCode);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
|
@ -16,6 +16,20 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GuiContainer.class)
|
||||
public abstract class GuiContainerMixin extends GuiScreen {
|
||||
|
||||
//#if MC==10809
|
||||
@Shadow private int dragSplittingButton;
|
||||
@Shadow private int dragSplittingRemnant;
|
||||
|
||||
@Inject(method = "updateDragSplitting", at = @At(value = "INVOKE", target = "Lnet/minecraft/item/ItemStack;copy()Lnet/minecraft/item/ItemStack;"), cancellable = true)
|
||||
private void patcher$fixRemnants(CallbackInfo ci) {
|
||||
if (this.dragSplittingButton == 2) {
|
||||
this.dragSplittingRemnant = mc.thePlayer.inventory.getItemStack().getMaxStackSize();
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
|
||||
@Inject(method = "initGui", at = @At("HEAD"))
|
||||
public void onOpenBlur(CallbackInfo ci) {
|
||||
if(Client.getInstance().getModInstances().getModByClass(InventoryBlurMod.class).isEnabled()) {
|
||||
|
@ -0,0 +1,20 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.gui.GuiGameOver;
|
||||
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(GuiGameOver.class)
|
||||
public class GuiGameOverMixin {
|
||||
//#if MC==10809
|
||||
@Shadow private int enableButtonsTimer;
|
||||
|
||||
@Inject(method = "initGui", at = @At("HEAD"))
|
||||
private void patcher$allowClickable(CallbackInfo ci) {
|
||||
this.enableButtonsTimer = 0;
|
||||
}
|
||||
//#endif
|
||||
}
|
@ -23,9 +23,7 @@ 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.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GuiIngame.class)
|
||||
@ -108,4 +106,9 @@ public abstract class GuiInGameMixin extends Gui {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@ModifyConstant(method = "renderScoreboard", constant = @Constant(intValue = 553648127))
|
||||
private int silent$fixTextBlending(int original) {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,13 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.gui.GuiLanguage;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(GuiLanguage.class)
|
||||
public class GuiLanguageMixin extends GuiScreen {
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
mc.ingameGUI.getChatGUI().refreshChat();
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.gui.GuiOptions;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(GuiOptions.class)
|
||||
public class GuiOptionsMixin extends GuiScreen {
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
mc.gameSettings.saveOptions();
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiScreenBook;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GuiScreenBook.class)
|
||||
public class GuiScreenBookMixin extends GuiScreen {
|
||||
@Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreenBook;handleComponentHover(Lnet/minecraft/util/IChatComponent;II)V"))
|
||||
private void silent$callSuper(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
|
||||
super.drawScreen(mouseX, mouseY, partialTicks);
|
||||
}
|
||||
|
||||
@Inject(method = "drawScreen", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreenBook;handleComponentHover(Lnet/minecraft/util/IChatComponent;II)V", shift = At.Shift.AFTER), cancellable = true)
|
||||
private void silent$cancelFurtherRendering(int mouseX, int mouseY, float partialTicks, CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
@ -0,0 +1,33 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.silentclient.client.utils.ResolutionHelper;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GuiScreen.class)
|
||||
public class GuiScreenMixin {
|
||||
@Shadow protected Minecraft mc;
|
||||
|
||||
//#if MC==10809
|
||||
@Redirect(method = "handleKeyboardInput", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Keyboard;getEventKeyState()Z", remap = false))
|
||||
private boolean silent$checkCharacter() {
|
||||
return Keyboard.getEventKey() == 0 && Keyboard.getEventCharacter() >= ' ' || Keyboard.getEventKeyState();
|
||||
}
|
||||
//#endif
|
||||
|
||||
@SuppressWarnings({"ConstantConditions", "RedundantCast"})
|
||||
@Inject(method = "handleInput", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/GuiScreen;handleKeyboardInput()V"), cancellable = true)
|
||||
private void silent$checkScreen(CallbackInfo ci) {
|
||||
if ((GuiScreen) (Object) this != this.mc.currentScreen) {
|
||||
ResolutionHelper.setScaleOverride(-1);
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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(targets = "net.minecraft.client.gui.GuiScreenOptionsSounds$Button")
|
||||
public class GuiScreenOptionsSoundsMixin {
|
||||
@Redirect(method = "mouseDragged(Lnet/minecraft/client/Minecraft;II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/settings/GameSettings;saveOptions()V"))
|
||||
private void patcher$cancelSaving(GameSettings instance) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Inject(method = "mouseReleased(II)V", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/audio/SoundHandler;playSound(Lnet/minecraft/client/audio/ISound;)V"))
|
||||
private void patcher$save(int mouseX, int mouseY, CallbackInfo ci) {
|
||||
Minecraft.getMinecraft().gameSettings.saveOptions();
|
||||
}
|
||||
}
|
@ -0,0 +1,24 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiScreenResourcePacks;
|
||||
import net.minecraft.client.resources.IResourcePack;
|
||||
import net.minecraft.client.resources.ResourcePackRepository;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(GuiScreenResourcePacks.class)
|
||||
public class GuiScreenResourcePacksMixin {
|
||||
@Inject(method = "actionPerformed", at = @At(value = "INVOKE", target = "Ljava/util/Collections;reverse(Ljava/util/List;)V", remap = false))
|
||||
private void patcher$clearHandles(CallbackInfo ci) {
|
||||
ResourcePackRepository repository = Minecraft.getMinecraft().getResourcePackRepository();
|
||||
for (ResourcePackRepository.Entry entry : repository.getRepositoryEntries()) {
|
||||
IResourcePack current = repository.getResourcePackInstance();
|
||||
if (current == null || !entry.getResourcePackName().equals(current.getPackName())) {
|
||||
entry.closeResourcePack();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
import net.minecraft.client.gui.GuiVideoSettings;
|
||||
import net.silentclient.client.mixin.ducks.GameSettingsExt;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
|
||||
@Mixin(GuiVideoSettings.class)
|
||||
public class GuiVideoSettingsMixin extends GuiScreen {
|
||||
//#if MC==10809
|
||||
@Override
|
||||
public void onGuiClosed() {
|
||||
super.onGuiClosed();
|
||||
((GameSettingsExt) mc.gameSettings).silent$onSettingsGuiClosed();
|
||||
}
|
||||
//#endif
|
||||
}
|
@ -0,0 +1,28 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.ItemModelMesher;
|
||||
import net.minecraft.client.resources.model.IBakedModel;
|
||||
import net.minecraft.client.resources.model.ModelManager;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@Mixin(ItemModelMesher.class)
|
||||
public class ItemModelMesherMixin {
|
||||
@Shadow
|
||||
@Final
|
||||
private ModelManager modelManager;
|
||||
|
||||
@Inject(method = "getItemModel(Lnet/minecraft/item/ItemStack;)Lnet/minecraft/client/resources/model/IBakedModel;", at = @At(value = "INVOKE_ASSIGN", target = "Lnet/minecraft/item/ItemStack;getItem()Lnet/minecraft/item/Item;"), locals = LocalCapture.CAPTURE_FAILSOFT, cancellable = true)
|
||||
private void silent$returnMissingModel(ItemStack stack, CallbackInfoReturnable<IBakedModel> cir, Item item) {
|
||||
if (item == null) {
|
||||
cir.setReturnValue(this.modelManager.getMissingModel());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,40 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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.CallbackInfoReturnable;
|
||||
|
||||
@Mixin(ItemStack.class)
|
||||
public class ItemStackMixin {
|
||||
private String silent$cachedDisplayName;
|
||||
|
||||
@Inject(method = "getDisplayName", at = @At("HEAD"), cancellable = true)
|
||||
private void silent$returnCachedDisplayName(CallbackInfoReturnable<String> cir) {
|
||||
if (silent$cachedDisplayName != null) {
|
||||
cir.setReturnValue(silent$cachedDisplayName);
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getDisplayName", at = @At("RETURN"))
|
||||
private void silent$cacheDisplayName(CallbackInfoReturnable<String> cir) {
|
||||
silent$cachedDisplayName = cir.getReturnValue();
|
||||
}
|
||||
|
||||
@Inject(method = "setStackDisplayName", at = @At("HEAD"))
|
||||
private void silent$resetCachedDisplayName(String displayName, CallbackInfoReturnable<ItemStack> cir) {
|
||||
silent$cachedDisplayName = null;
|
||||
}
|
||||
|
||||
//#if MC==10809
|
||||
@Redirect(
|
||||
method = "getTooltip",
|
||||
at = @At(value = "INVOKE", target = "Ljava/lang/Integer;toHexString(I)Ljava/lang/String;")
|
||||
)
|
||||
private String silent$fixHexColorString(int i) {
|
||||
return String.format("%06X", i);
|
||||
}
|
||||
//#endif
|
||||
}
|
@ -7,6 +7,7 @@ import net.silentclient.client.mods.settings.FPSBoostMod;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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(LayerArrow.class)
|
||||
@ -17,4 +18,14 @@ public class LayerArrowMixin {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "doRenderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderHelper;disableStandardItemLighting()V"))
|
||||
private void silent$removeDisable() {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Redirect(method = "doRenderLayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/RenderHelper;enableStandardItemLighting()V"))
|
||||
private void silent$removeEnable() {
|
||||
// no-op
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.entity.layers.LayerCreeperCharge;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.ModifyArg;
|
||||
import org.spongepowered.asm.mixin.injection.Slice;
|
||||
|
||||
@Mixin(LayerCreeperCharge.class)
|
||||
public class LayerCreeperChargeMixin {
|
||||
@ModifyArg(
|
||||
method = "doRenderLayer(Lnet/minecraft/entity/monster/EntityCreeper;FFFFFFF)V",
|
||||
slice = @Slice(
|
||||
from = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/model/ModelCreeper;render(Lnet/minecraft/entity/Entity;FFFFFF)V"
|
||||
)
|
||||
),
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/client/renderer/GlStateManager;depthMask(Z)V"
|
||||
)
|
||||
)
|
||||
private boolean silent$fixDepth(boolean original) {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerSpiderEyes;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(LayerSpiderEyes.class)
|
||||
public class LayerSpiderEyesMixin {
|
||||
@Inject(method = "doRenderLayer(Lnet/minecraft/entity/monster/EntitySpider;FFFFFFF)V", at = @At("TAIL"))
|
||||
private void silent$fixDepth(CallbackInfo ci) {
|
||||
GlStateManager.depthMask(true);
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.layers.LayerWitherAura;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(LayerWitherAura.class)
|
||||
public class LayerWitherAuraMixin {
|
||||
@Inject(method = "doRenderLayer(Lnet/minecraft/entity/boss/EntityWither;FFFFFFF)V", at = @At("TAIL"))
|
||||
private void patcher$fixDepth(CallbackInfo ci) {
|
||||
GlStateManager.depthMask(true);
|
||||
}
|
||||
}
|
@ -20,6 +20,7 @@ import net.silentclient.client.gui.util.BackgroundPanorama;
|
||||
import net.silentclient.client.hooks.MinecraftHook;
|
||||
import net.silentclient.client.mods.render.AnimationsMod;
|
||||
import net.silentclient.client.mods.settings.FPSBoostMod;
|
||||
import org.apache.commons.lang3.SystemUtils;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.lwjgl.LWJGLException;
|
||||
import org.lwjgl.input.Keyboard;
|
||||
@ -232,4 +233,18 @@ public abstract class MinecraftMixin {
|
||||
// No-op
|
||||
}
|
||||
//#endif
|
||||
|
||||
//#if MC==10809
|
||||
@Inject(method = "toggleFullscreen", at = @At(value = "INVOKE", target = "Lorg/lwjgl/opengl/Display;setFullscreen(Z)V", remap = false))
|
||||
private void silent$resolveScreenState(CallbackInfo ci) {
|
||||
if (!this.fullscreen && SystemUtils.IS_OS_WINDOWS) {
|
||||
Display.setResizable(false);
|
||||
Display.setResizable(true);
|
||||
}
|
||||
}
|
||||
@Redirect(method = "dispatchKeypresses", at = @At(value = "INVOKE", target = "Lorg/lwjgl/input/Keyboard;getEventCharacter()C", remap = false))
|
||||
private char silent$resolveForeignKeyboards() {
|
||||
return (char) (Keyboard.getEventCharacter() + 256);
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
|
@ -0,0 +1,16 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.nbt.NBTBase;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(NBTTagCompound.class)
|
||||
public class NBTTagCompoundMixin {
|
||||
@Inject(method = "setTag", at = @At("HEAD"))
|
||||
private void silent$failFast(String key, NBTBase value, CallbackInfo ci) {
|
||||
if (value == null) throw new IllegalArgumentException("Invalid null NBT value with key " + key);
|
||||
}
|
||||
}
|
@ -3,6 +3,7 @@ package net.silentclient.client.mixin.mixins;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.AbstractClientPlayer;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelPlayer;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.entity.RenderPlayer;
|
||||
import net.minecraft.client.renderer.entity.RendererLivingEntity;
|
||||
@ -20,6 +21,7 @@ import net.silentclient.client.utils.HypixelUtils;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
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(RenderPlayer.class)
|
||||
@ -56,4 +58,9 @@ public abstract class RenderPlayerMixin extends RendererLivingEntity<AbstractCli
|
||||
renderLivingLabel(entityIn, "§r" + ((AbstractClientPlayerExt) entityIn).silent$getAccount().getNametagMessage() + "§r", x, y + ((double) ((float) getFontRendererFromRenderManager().FONT_HEIGHT * 1.15F * p_177069_9_)), z, 64);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "renderRightArm", at = @At(value = "FIELD", target = "Lnet/minecraft/client/model/ModelPlayer;isSneak:Z", ordinal = 0))
|
||||
private void silent$resetArmState(ModelPlayer modelPlayer, boolean value) {
|
||||
modelPlayer.isRiding = modelPlayer.isSneak = false;
|
||||
}
|
||||
}
|
||||
|
@ -2,16 +2,30 @@ package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.resources.ResourcePackRepository;
|
||||
import net.silentclient.client.hooks.ResourcePackRepositoryHook;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
@Mixin(ResourcePackRepository.class)
|
||||
public class ResourcePackRepositoryMixin {
|
||||
@Shadow @Final private File dirServerResourcepacks;
|
||||
|
||||
@Inject(method = "updateRepositoryEntriesAll", at = @At("HEAD"), cancellable = true)
|
||||
private void patcher$searchUsingSet(CallbackInfo ci) {
|
||||
private void silent$searchUsingSet(CallbackInfo ci) {
|
||||
ResourcePackRepositoryHook.updateRepositoryEntriesAll((ResourcePackRepository) (Object) this);
|
||||
ci.cancel();
|
||||
}
|
||||
|
||||
@SuppressWarnings("ResultOfMethodCallIgnored")
|
||||
@Inject(method = "deleteOldServerResourcesPacks", at = @At("HEAD"))
|
||||
private void silent$createDirectory(CallbackInfo ci) {
|
||||
if (!this.dirServerResourcepacks.exists()) {
|
||||
this.dirServerResourcepacks.mkdirs();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.network.PacketBuffer;
|
||||
import net.minecraft.network.play.INetHandlerPlayClient;
|
||||
import net.minecraft.network.play.server.S3FPacketCustomPayload;
|
||||
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(S3FPacketCustomPayload.class)
|
||||
public class S3FPacketCustomPayloadMixin {
|
||||
//#if MC==10809
|
||||
@Shadow private PacketBuffer data;
|
||||
|
||||
@Inject(method = "processPacket(Lnet/minecraft/network/play/INetHandlerPlayClient;)V", at = @At("TAIL"))
|
||||
private void patcher$releaseData(INetHandlerPlayClient handler, CallbackInfo ci) {
|
||||
if (this.data != null) {
|
||||
this.data.release();
|
||||
}
|
||||
}
|
||||
//#endif
|
||||
}
|
@ -0,0 +1,51 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.scoreboard.ScoreObjective;
|
||||
import net.minecraft.scoreboard.ScorePlayerTeam;
|
||||
import net.minecraft.scoreboard.Scoreboard;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(Scoreboard.class)
|
||||
public abstract class ScoreboardMixin {
|
||||
@Shadow public abstract ScorePlayerTeam getTeam(String p_96508_1_);
|
||||
|
||||
@Inject(method = "removeTeam", at = @At("HEAD"), cancellable = true)
|
||||
private void patcher$checkIfTeamIsNull(ScorePlayerTeam team, CallbackInfo ci) {
|
||||
if (team == null) ci.cancel();
|
||||
}
|
||||
|
||||
@Redirect(method = "removeTeam", at = @At(value = "INVOKE", target = "Ljava/util/Map;remove(Ljava/lang/Object;)Ljava/lang/Object;", ordinal = 0, remap = false))
|
||||
private <K, V> V patcher$checkIfRegisteredNameIsNull(Map<K, V> instance, K o) {
|
||||
if (o != null) return instance.remove(o);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Inject(method = "removeObjective", at = @At("HEAD"), cancellable = true)
|
||||
private void patcher$checkIfObjectiveIsNull(ScoreObjective objective, CallbackInfo ci) {
|
||||
if (objective == null) ci.cancel();
|
||||
}
|
||||
|
||||
@Redirect(method = "removeObjective", at = @At(value = "INVOKE", target = "Ljava/util/Map;remove(Ljava/lang/Object;)Ljava/lang/Object;", ordinal = 0, remap = false))
|
||||
private <K, V> V patcher$checkIfNameIsNull(Map<K, V> instance, K o) {
|
||||
if (o != null) return instance.remove(o);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Inject(method = "createTeam", at = @At(value = "CONSTANT", args = "stringValue=A team with the name '"), cancellable = true)
|
||||
private void patcher$returnExistingTeam(String name, CallbackInfoReturnable<ScorePlayerTeam> cir) {
|
||||
cir.setReturnValue(this.getTeam(name));
|
||||
}
|
||||
|
||||
@Inject(method = "removePlayerFromTeam", at = @At(value = "CONSTANT", args = "stringValue=Player is either on another team or not on any team. Cannot remove from team '"), cancellable = true)
|
||||
private void patcher$silenceException(CallbackInfo ci) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
@ -0,0 +1,26 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.gui.ServerListEntryNormal;
|
||||
import net.minecraft.client.multiplayer.ServerData;
|
||||
import net.silentclient.client.Client;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ServerListEntryNormal.class)
|
||||
public abstract class ServerListEntryNormalMixin {
|
||||
@Shadow protected abstract void prepareServerIcon();
|
||||
@Shadow @Final private ServerData server;
|
||||
|
||||
@Redirect(method = "drawEntry", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/gui/ServerListEntryNormal;prepareServerIcon()V"))
|
||||
private void silent$resolveCrash(ServerListEntryNormal serverListEntryNormal) {
|
||||
try {
|
||||
prepareServerIcon();
|
||||
} catch (Exception e) {
|
||||
Client.logger.error("Failed to prepare server icon, setting to default.", e);
|
||||
server.setBase64EncodedIconData(null);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,30 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.gui.GuiListExtended;
|
||||
import net.minecraft.client.gui.ServerListEntryLanDetected;
|
||||
import net.minecraft.client.gui.ServerSelectionList;
|
||||
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;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(ServerSelectionList.class)
|
||||
public class ServerSelectionListMixin {
|
||||
@Shadow @Final private List<ServerListEntryLanDetected> serverListLan;
|
||||
@Shadow @Final private GuiListExtended.IGuiListEntry lanScanEntry;
|
||||
|
||||
@Inject(
|
||||
method = "getListEntry",
|
||||
at = @At(value = "FIELD", target = "Lnet/minecraft/client/gui/ServerSelectionList;serverListLan:Ljava/util/List;"),
|
||||
cancellable = true
|
||||
)
|
||||
private void silent$resolveIndexError(int index, CallbackInfoReturnable<GuiListExtended.IGuiListEntry> cir) {
|
||||
if (index >= this.serverListLan.size()) {
|
||||
cir.setReturnValue(this.lanScanEntry);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,59 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.audio.ISound;
|
||||
import net.minecraft.client.audio.SoundManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.Marker;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.*;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import paulscode.sound.SoundSystem;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@Mixin(SoundManager.class)
|
||||
public abstract class SoundManagerMixin {
|
||||
//#if MC==10809
|
||||
@Shadow public abstract boolean isSoundPlaying(ISound sound);
|
||||
|
||||
@Shadow @Final private Map<String, ISound> playingSounds;
|
||||
|
||||
private final List<String> silent$pausedSounds = new ArrayList<>();
|
||||
|
||||
@SuppressWarnings("InvalidInjectorMethodSignature")
|
||||
@Redirect(
|
||||
method = "pauseAllSounds",
|
||||
at = @At(value = "INVOKE", target = "Lnet/minecraft/client/audio/SoundManager$SoundSystemStarterThread;pause(Ljava/lang/String;)V", remap = false)
|
||||
)
|
||||
private void silent$onlyPauseSoundIfNecessary(@Coerce SoundSystem soundSystem, String sound) {
|
||||
if (isSoundPlaying(playingSounds.get(sound))) {
|
||||
soundSystem.pause(sound);
|
||||
silent$pausedSounds.add(sound);
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(
|
||||
method = "resumeAllSounds",
|
||||
at = @At(value = "INVOKE", target = "Ljava/util/Set;iterator()Ljava/util/Iterator;", remap = false)
|
||||
)
|
||||
private Iterator<String> silent$iterateOverPausedSounds(Set<String> keySet) {
|
||||
return silent$pausedSounds.iterator();
|
||||
}
|
||||
|
||||
@Inject(method = "resumeAllSounds", at = @At("TAIL"))
|
||||
private void silent$clearPausedSounds(CallbackInfo ci) {
|
||||
silent$pausedSounds.clear();
|
||||
}
|
||||
//#endif
|
||||
|
||||
@Redirect(
|
||||
method = "playSound",
|
||||
slice = @Slice(from = @At(value = "CONSTANT", args = "stringValue=Unable to play unknown soundEvent: {}", ordinal = 0)),
|
||||
at = @At(value = "INVOKE", target = "Lorg/apache/logging/log4j/Logger;warn(Lorg/apache/logging/log4j/Marker;Ljava/lang/String;[Ljava/lang/Object;)V", ordinal = 0, remap = false)
|
||||
)
|
||||
private void patcher$silenceWarning(Logger instance, Marker marker, String s, Object[] objects) {
|
||||
// No-op
|
||||
}
|
||||
}
|
@ -0,0 +1,95 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import com.google.common.collect.Lists;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.LayeredColorMaskTexture;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityBannerRenderer;
|
||||
import net.minecraft.item.EnumDyeColor;
|
||||
import net.minecraft.tileentity.TileEntityBanner;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.World;
|
||||
import org.spongepowered.asm.mixin.*;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Mixin(TileEntityBannerRenderer.class)
|
||||
public class TileEntityBannerRendererMixin {
|
||||
private final String silent$renderTileEntityAtDesc =
|
||||
//#if MC==10809
|
||||
"renderTileEntityAt(Lnet/minecraft/tileentity/TileEntityBanner;DDDFI)V";
|
||||
//#else
|
||||
//$$ "renderTileEntityAt(Lnet/minecraft/tileentity/TileEntityBanner;DDDFIF)V";
|
||||
//#endif
|
||||
|
||||
@Redirect(method = silent$renderTileEntityAtDesc, at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getTotalWorldTime()J"))
|
||||
private long silent$resolveOverflow(World world) {
|
||||
return world.getTotalWorldTime() % 100L;
|
||||
}
|
||||
|
||||
//#if MC==10809
|
||||
@Shadow
|
||||
@Final
|
||||
private static Map<String, TileEntityBannerRenderer.TimedBannerTexture> DESIGNS;
|
||||
|
||||
@Shadow @Final private static ResourceLocation BANNERTEXTURES;
|
||||
|
||||
/**
|
||||
* @author asbyth
|
||||
* @reason Resolve banners in chests not displaying once cache is full
|
||||
*/
|
||||
@Overwrite
|
||||
private ResourceLocation func_178463_a(TileEntityBanner banner) {
|
||||
String texture = banner.getPatternResourceLocation();
|
||||
|
||||
if (texture.isEmpty()) {
|
||||
return null;
|
||||
} else {
|
||||
TileEntityBannerRenderer.TimedBannerTexture timedTexture = DESIGNS.get(texture);
|
||||
if (timedTexture == null) {
|
||||
if (DESIGNS.size() >= 256 && !this.silent$freeCacheSlot()) {
|
||||
return BANNERTEXTURES;
|
||||
}
|
||||
|
||||
List<TileEntityBanner.EnumBannerPattern> patternList = banner.getPatternList();
|
||||
List<EnumDyeColor> colorList = banner.getColorList();
|
||||
List<String> patternPath = Lists.newArrayList();
|
||||
|
||||
for (TileEntityBanner.EnumBannerPattern pattern : patternList) {
|
||||
patternPath.add("textures/entity/banner/" + pattern.getPatternName() + ".png");
|
||||
}
|
||||
|
||||
timedTexture = new TileEntityBannerRenderer.TimedBannerTexture();
|
||||
timedTexture.bannerTexture = new ResourceLocation(texture);
|
||||
Minecraft.getMinecraft().getTextureManager().loadTexture(timedTexture.bannerTexture, new LayeredColorMaskTexture(BANNERTEXTURES, patternPath, colorList));
|
||||
DESIGNS.put(texture, timedTexture);
|
||||
}
|
||||
|
||||
timedTexture.systemTime = System.currentTimeMillis();
|
||||
return timedTexture.bannerTexture;
|
||||
}
|
||||
}
|
||||
|
||||
@Unique
|
||||
private boolean silent$freeCacheSlot() {
|
||||
long start = System.currentTimeMillis();
|
||||
Iterator<String> iterator = DESIGNS.keySet().iterator();
|
||||
|
||||
while (iterator.hasNext()) {
|
||||
String next = iterator.next();
|
||||
TileEntityBannerRenderer.TimedBannerTexture timedTexture = DESIGNS.get(next);
|
||||
|
||||
if ((start - timedTexture.systemTime) > 5000L) {
|
||||
Minecraft.getMinecraft().getTextureManager().deleteTexture(timedTexture.bannerTexture);
|
||||
iterator.remove();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return DESIGNS.size() < 256;
|
||||
}
|
||||
//#endif
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.RenderHelper;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
|
||||
@Mixin(TileEntityRendererDispatcher.class)
|
||||
public class TileEntityRendererDispatcherMixin {
|
||||
//#if MC==10809
|
||||
@Inject(method = "renderTileEntity", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getCombinedLight(Lnet/minecraft/util/BlockPos;I)I"))
|
||||
private void silent$enableLighting(CallbackInfo ci) {
|
||||
RenderHelper.enableStandardItemLighting();
|
||||
}
|
||||
//#endif
|
||||
}
|
@ -1,9 +1,11 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySkullRenderer;
|
||||
import net.minecraft.tileentity.TileEntitySkull;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.mods.settings.FPSBoostMod;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Inject;
|
||||
@ -17,4 +19,12 @@ public class TileEntitySkullRendererMixin {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
//#if MC==10809
|
||||
@Inject(method = "renderSkull", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/model/ModelBase;render(Lnet/minecraft/entity/Entity;FFFFFF)V"))
|
||||
private void patcher$enableBlending(CallbackInfo ci) {
|
||||
GlStateManager.enableBlend();
|
||||
GlStateManager.tryBlendFuncSeparate(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA, GL11.GL_ONE, GL11.GL_ZERO);
|
||||
}
|
||||
//#endif
|
||||
}
|
||||
|
@ -0,0 +1,24 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.vertex.VertexBuffer;
|
||||
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;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
|
||||
@Mixin(VertexBuffer.class)
|
||||
public class VertexBufferMixin {
|
||||
@Shadow
|
||||
private int glBufferId;
|
||||
|
||||
// inject at INVOKE rather than HEAD as OptiFine changes this method for its Render Regions option
|
||||
@Inject(method = "bufferData", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/renderer/vertex/VertexBuffer;bindBuffer()V"), cancellable = true)
|
||||
private void patcher$ignoreRemovedBuffers(ByteBuffer byteBuffer, CallbackInfo ci) {
|
||||
if (this.glBufferId == -1) {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,34 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityFX;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityFallingBlock;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.item.EntityTNTPrimed;
|
||||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldProvider;
|
||||
import net.silentclient.client.Client;
|
||||
import net.silentclient.client.event.impl.EntityJoinLevelEvent;
|
||||
import org.spongepowered.asm.mixin.Final;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.Unique;
|
||||
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.Redirect;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Mixin(World.class)
|
||||
public class WorldMixin {
|
||||
@Shadow @Final public boolean isRemote;
|
||||
|
||||
@Inject(method = "checkLightFor", at = @At("HEAD"), cancellable = true)
|
||||
private void checkLightFor(CallbackInfoReturnable<Boolean> cir) {
|
||||
if (this.canFullbright()) {
|
||||
@ -51,4 +66,16 @@ public class WorldMixin {
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "getCollidingBoundingBoxes", at = @At(value = "INVOKE", target = "Lnet/minecraft/world/World;getEntitiesWithinAABBExcludingEntity(Lnet/minecraft/entity/Entity;Lnet/minecraft/util/AxisAlignedBB;)Ljava/util/List;"), cancellable = true, locals = LocalCapture.CAPTURE_FAILSOFT)
|
||||
private void silent$filterEntities(Entity entityIn, AxisAlignedBB bb, CallbackInfoReturnable<List<AxisAlignedBB>> cir, List<AxisAlignedBB> list) {
|
||||
if (entityIn instanceof EntityTNTPrimed || entityIn instanceof EntityFallingBlock || entityIn instanceof EntityItem
|
||||
// particles aren't entities after 1.9
|
||||
//#if MC==10809
|
||||
|| entityIn instanceof EntityFX
|
||||
//#endif
|
||||
) {
|
||||
cir.setReturnValue(list);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,27 @@
|
||||
package net.silentclient.client.mixin.mixins;
|
||||
|
||||
import net.minecraft.client.renderer.WorldRenderer;
|
||||
import net.minecraft.client.renderer.vertex.VertexFormat;
|
||||
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;
|
||||
|
||||
import java.nio.IntBuffer;
|
||||
|
||||
@Mixin(WorldRenderer.class)
|
||||
public class WorldRendererMixin {
|
||||
@Shadow private IntBuffer rawIntBuffer;
|
||||
@Shadow private VertexFormat vertexFormat;
|
||||
|
||||
@Inject(method = "finishDrawing", at = @At(value = "INVOKE", target = "Ljava/nio/ByteBuffer;limit(I)Ljava/nio/Buffer;", remap = false))
|
||||
private void silent$resetBuffer(CallbackInfo ci) {
|
||||
this.rawIntBuffer.position(0);
|
||||
}
|
||||
|
||||
@Inject(method = "endVertex", at = @At("HEAD"))
|
||||
private void silent$adjustBuffer(CallbackInfo ci) {
|
||||
this.rawIntBuffer.position(this.rawIntBuffer.position() + this.vertexFormat.getIntegerSize());
|
||||
}
|
||||
}
|
@ -0,0 +1,22 @@
|
||||
package net.silentclient.client.utils;
|
||||
|
||||
public class ResolutionHelper {
|
||||
private static int currentScaleOverride = -1;
|
||||
private static int scaleOverride = -1;
|
||||
|
||||
public static int getCurrentScaleOverride() {
|
||||
return currentScaleOverride;
|
||||
}
|
||||
|
||||
public static void setCurrentScaleOverride(int currentScaleOverride) {
|
||||
ResolutionHelper.currentScaleOverride = currentScaleOverride;
|
||||
}
|
||||
|
||||
public static int getScaleOverride() {
|
||||
return scaleOverride;
|
||||
}
|
||||
|
||||
public static void setScaleOverride(int scaleOverride) {
|
||||
ResolutionHelper.scaleOverride = scaleOverride;
|
||||
}
|
||||
}
|
@ -71,6 +71,35 @@
|
||||
"mixins.MinecraftServerMixin",
|
||||
"mixins.NBTTagStringMixin",
|
||||
"mixins.NodeProcessorMixin",
|
||||
"mixins.VisGraphMixin"
|
||||
"mixins.VisGraphMixin",
|
||||
"mixins.BlockRedstoneTorchMixin",
|
||||
"mixins.ItemStackMixin",
|
||||
"mixins.C17PacketCustomPayloadMixin",
|
||||
"mixins.S3FPacketCustomPayloadMixin",
|
||||
"mixins.BlockFluidRendererMixin",
|
||||
"mixins.BlockModelRendererAmbientOcclusionFaceMixin",
|
||||
"mixins.CommandHandlerMixin",
|
||||
"mixins.EntityXPOrbMixin",
|
||||
"mixins.GuiGameOverMixin",
|
||||
"mixins.GuiOptionsMixin",
|
||||
"mixins.GuiScreenBookMixin",
|
||||
"mixins.GuiScreenMixin",
|
||||
"mixins.GuiScreenOptionsSoundsMixin",
|
||||
"mixins.GuiScreenResourcePacksMixin",
|
||||
"mixins.GuiVideoSettingsMixin",
|
||||
"mixins.LayerCreeperChargeMixin",
|
||||
"mixins.LayerSpiderEyesMixin",
|
||||
"mixins.LayerWitherAuraMixin",
|
||||
"mixins.ScoreboardMixin",
|
||||
"mixins.SoundManagerMixin",
|
||||
"mixins.TileEntityBannerRendererMixin",
|
||||
"mixins.TileEntityRendererDispatcherMixin",
|
||||
"mixins.VertexBufferMixin",
|
||||
"mixins.ItemModelMesherMixin",
|
||||
"mixins.EntityLivingBaseMixin",
|
||||
"mixins.NBTTagCompoundMixin",
|
||||
"mixins.ServerListEntryNormalMixin",
|
||||
"mixins.ServerSelectionListMixin",
|
||||
"mixins.WorldRendererMixin"
|
||||
]
|
||||
}
|
Loading…
Reference in New Issue
Block a user