From cd9ad7311ad126e1ad75fc03415ab5cd44f69390 Mon Sep 17 00:00:00 2001 From: kirillsaint Date: Thu, 11 Jan 2024 21:10:15 +0600 Subject: [PATCH] MineMen fix! --- .../client/mixin/mixins/MinecraftMixin.java | 6 +- .../mixin/mixins/PlayerControllerMPMixin.java | 24 +++ src/main/resources/mixins.SilentClient.json | 187 +++++++++--------- 3 files changed, 123 insertions(+), 94 deletions(-) create mode 100644 src/main/java/net/silentclient/client/mixin/mixins/PlayerControllerMPMixin.java diff --git a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java index 0c9340e..317558b 100644 --- a/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java +++ b/src/main/java/net/silentclient/client/mixin/mixins/MinecraftMixin.java @@ -1,6 +1,7 @@ package net.silentclient.client.mixin.mixins; import net.minecraft.client.Minecraft; +import net.minecraft.client.entity.EntityPlayerSP; import net.minecraft.client.gui.*; import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.renderer.EntityRenderer; @@ -132,6 +133,8 @@ public abstract class MinecraftMixin implements MinecraftExt { @Shadow private Timer timer; + @Shadow public EntityPlayerSP thePlayer; + @Inject(method = "displayGuiScreen", at = @At("HEAD"), cancellable = true) public void displayGuiScreenInject(GuiScreen guiScreenIn, CallbackInfo ci) { if(guiScreenIn instanceof SilentScreen) { @@ -198,7 +201,7 @@ public abstract class MinecraftMixin implements MinecraftExt { new EventClickMouse(0).call(); } - @Inject(method = "rightClickMouse", at = @At("HEAD")) + @Inject(method = "rightClickMouse", at = @At("HEAD"), cancellable = true) public void rightClickMouse(CallbackInfo ci) { if (AnimationsMod.getSettingBoolean("Punching During Usage") && Minecraft.getMinecraft().playerController.getIsHittingBlock() && @@ -210,6 +213,7 @@ public abstract class MinecraftMixin implements MinecraftExt { // think we are still breaking the block while right clicking. // Which is bad. Obviously. Minecraft.getMinecraft().playerController.resetBlockRemoving(); + ci.cancel(); } } diff --git a/src/main/java/net/silentclient/client/mixin/mixins/PlayerControllerMPMixin.java b/src/main/java/net/silentclient/client/mixin/mixins/PlayerControllerMPMixin.java new file mode 100644 index 0000000..abed799 --- /dev/null +++ b/src/main/java/net/silentclient/client/mixin/mixins/PlayerControllerMPMixin.java @@ -0,0 +1,24 @@ +package net.silentclient.client.mixin.mixins; + +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.PlayerControllerMP; +import net.minecraft.client.network.NetHandlerPlayClient; +import net.minecraft.init.Items; +import net.minecraft.item.ItemStack; +import net.minecraft.network.Packet; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Redirect; + +@Mixin(PlayerControllerMP.class) +public class PlayerControllerMPMixin { + @Redirect(method = "onPlayerRightClick", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/network/NetHandlerPlayClient;addToSendQueue(Lnet/minecraft/network/Packet;)V")) + public void fixPacketSend(NetHandlerPlayClient instance, Packet p_147297_1_) { + ItemStack itemstack = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(); + if(itemstack.getItem() == Items.diamond_sword || itemstack.getItem() == Items.stone_sword || itemstack.getItem() == Items.golden_sword || itemstack.getItem() == Items.iron_sword || itemstack.getItem() == Items.wooden_sword) { + return; + } + + instance.addToSendQueue(p_147297_1_); + } +} diff --git a/src/main/resources/mixins.SilentClient.json b/src/main/resources/mixins.SilentClient.json index fd92d82..fe44662 100644 --- a/src/main/resources/mixins.SilentClient.json +++ b/src/main/resources/mixins.SilentClient.json @@ -3,121 +3,122 @@ "package": "net.silentclient.client.mixin", "refmap": "mixins.SilentClient.refmap.json", "mixins": [ - "mixins.MinecraftMixin", - "mixins.AbstractClientPlayerMixin", - "mixins.GuiChatMixin", + "accessors.EntityArrowAccessor", + "accessors.FontRendererAccessor", "accessors.GuiAccessor", + "accessors.GuiInGameAccessor", + "accessors.ItemFoodAccessor", + "accessors.MinecraftAccessor", + "accessors.NetworkPlayerInfoAccessor", "accessors.RenderItemAccessor", + "accessors.RenderManagerAccessor", + "accessors.ResourcePackRepositoryAccessor", "accessors.SimpleReloadableResourceManagerAccessor", "accessors.TextureManagerAccessor", - "mixins.EntityRendererMixin", - "mixins.RenderEntityItemMixin", - "mixins.RenderItemFrameMixin", - "mixins.TileEntityMobSpawnerRendererMixin", - "mixins.EntityFXMixin", - "mixins.EffectRendererMixin", - "accessors.RenderManagerAccessor", - "mixins.RenderPlayerMixin", - "mixins.GuiInGameMixin", - "mixins.LayerCapeMixin", - "mixins.GuiAchievementMixin", - "mixins.GuiMultiplayerMixin", - "mixins.GameSettingsMixin", - "mixins.EntityPlayerMixin", - "mixins.NetHandlerPlayClientMixin", - "mixins.WorldMixin", - "mixins.RendererLivingEntityMixin", - "mixins.WorldClientMixin", - "mixins.NetworkManagerMixin", - "mixins.RenderManagerMixin", - "mixins.ItemRendererMixin", - "mixins.RenderGlobalMixin", - "mixins.LayerArmorBaseMixin", - "mixins.RenderItemMixin", - "mixins.ModelBipedMixin", - "mixins.LoadingScreenRendererMixin", - "accessors.MinecraftAccessor", - "accessors.ItemFoodAccessor", - "mixins.BlockGlassMixin", - "mixins.ShaderGroupMixin", - "mixins.GuiContainerMixin", - "mixins.InventoryEffectRendererMixin", - "mixins.TextureManagerMixin", - "mixins.ChunkMixin", - "mixins.ArmorStandRendererMixin", - "mixins.RenderMixin", - "accessors.FontRendererAccessor", - "mixins.FontRendererMixin", - "mixins.WorldInfoMixin", - "mixins.GuiPlayerTabOverlayMixin", - "mixins.GuiNewChatMixin", - "mixins.FramebufferMixin", - "mixins.GlStateManagerMixin", - "accessors.GuiInGameAccessor", - "mixins.TexturedQuadMixin", "accessors.WorldRendererAccessor", - "mixins.ModelRendererMixin", - "mixins.BlockRendererDispatcherMixin", - "mixins.MobSpawnerBaseLogicMixin", - "mixins.ChunkRenderDispatcherMixin", - "mixins.LayerArrowMixin", + "accessors.optifine.ConfigAccessor", + "accessors.optifine.CustomColorsAccessor", + "mixins.AbstractClientPlayerMixin", + "mixins.ArmorStandRendererMixin", + "mixins.BlockFluidRendererMixin", + "mixins.BlockGlassMixin", "mixins.BlockLiquidMixin", - "mixins.TileEntitySkullRendererMixin", - "accessors.EntityArrowAccessor", + "mixins.BlockModelRendererAmbientOcclusionFaceMixin", "mixins.BlockPosMixin", + "mixins.BlockRedstoneTorchMixin", + "mixins.BlockRendererDispatcherMixin", + "mixins.C17PacketCustomPayloadMixin", + "mixins.ChunkMixin", + "mixins.ChunkRenderDispatcherMixin", + "mixins.CommandHandlerMixin", + "mixins.EffectRendererMixin", + "mixins.EntityFXMixin", + "mixins.EntityLivingBaseMixin", "mixins.EntityMixin", "mixins.EntityOtherPlayerMPMixin", - "mixins.GameRulesValueMixin", - "mixins.MinecraftServerMixin", - "mixins.NBTTagStringMixin", - "mixins.NodeProcessorMixin", - "mixins.VisGraphMixin", - "mixins.BlockRedstoneTorchMixin", - "mixins.ItemStackMixin", - "mixins.C17PacketCustomPayloadMixin", - "mixins.S3FPacketCustomPayloadMixin", - "mixins.BlockFluidRendererMixin", - "mixins.BlockModelRendererAmbientOcclusionFaceMixin", - "mixins.CommandHandlerMixin", + "mixins.EntityPacketsMixin", + "mixins.EntityPlayerMixin", + "mixins.EntityRendererMixin", "mixins.EntityXPOrbMixin", + "mixins.FontRendererMixin", + "mixins.FramebufferMixin", + "mixins.GameRulesValueMixin", + "mixins.GameSettingsMixin", + "mixins.GlStateManagerMixin", + "mixins.GuiAchievementMixin", + "mixins.GuiChatMixin", + "mixins.GuiContainerMixin", + "mixins.GuiDisconnectedMixin", "mixins.GuiGameOverMixin", + "mixins.GuiInGameMixin", + "mixins.GuiLanguageMixin", + "mixins.GuiMultiplayerMixin", + "mixins.GuiNewChatMixin", "mixins.GuiOptionsMixin", + "mixins.GuiPlayerTabOverlayMixin", "mixins.GuiScreenBookMixin", "mixins.GuiScreenMixin", "mixins.GuiScreenOptionsSoundsMixin", "mixins.GuiScreenResourcePacksMixin", "mixins.GuiVideoSettingsMixin", + "mixins.InventoryEffectRendererMixin", + "mixins.ItemModelMesherMixin", + "mixins.ItemRendererMixin", + "mixins.ItemStackMixin", + "mixins.LayerArmorBaseMixin", + "mixins.LayerArrowMixin", + "mixins.LayerCapeMixin", "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", - "mixins.ResourcePackRepositoryMixin", - "accessors.ResourcePackRepositoryAccessor", "mixins.LazyLoadBaseMixin", - "mixins.PacketThreadUtilMixin", - "mixins.ServerAddressMixin", - "mixins.ServerListMixin", - "mixins.EntityPacketsMixin", - "mixins.ScreenShotHelperMixin", - "mixins.RenderTNTPrimedMixin", - "mixins.GuiDisconnectedMixin", - "accessors.optifine.CustomColorsAccessor", - "accessors.optifine.ConfigAccessor", - "mixins.NetworkPlayerInfoMixin", - "accessors.NetworkPlayerInfoAccessor", + "mixins.LoadingScreenRendererMixin", "mixins.MathHelperMixin", - "mixins.GuiLanguageMixin", + "mixins.MinecraftMixin", + "mixins.MinecraftServerMixin", + "mixins.MobSpawnerBaseLogicMixin", + "mixins.ModelBipedMixin", + "mixins.ModelRendererMixin", + "mixins.NBTTagCompoundMixin", + "mixins.NBTTagStringMixin", + "mixins.NetHandlerPlayClientMixin", + "mixins.NetworkManagerMixin", + "mixins.NetworkPlayerInfoMixin", + "mixins.NodeProcessorMixin", + "mixins.PacketThreadUtilMixin", + "mixins.PlayerControllerMPMixin", "mixins.RenderArrowMixin", - "mixins.RenderFishMixin" + "mixins.RenderEntityItemMixin", + "mixins.RendererLivingEntityMixin", + "mixins.RenderFishMixin", + "mixins.RenderGlobalMixin", + "mixins.RenderItemFrameMixin", + "mixins.RenderItemMixin", + "mixins.RenderManagerMixin", + "mixins.RenderMixin", + "mixins.RenderPlayerMixin", + "mixins.RenderTNTPrimedMixin", + "mixins.ResourcePackRepositoryMixin", + "mixins.S3FPacketCustomPayloadMixin", + "mixins.ScoreboardMixin", + "mixins.ScreenShotHelperMixin", + "mixins.ServerAddressMixin", + "mixins.ServerListEntryNormalMixin", + "mixins.ServerListMixin", + "mixins.ServerSelectionListMixin", + "mixins.ShaderGroupMixin", + "mixins.SoundManagerMixin", + "mixins.TexturedQuadMixin", + "mixins.TextureManagerMixin", + "mixins.TileEntityBannerRendererMixin", + "mixins.TileEntityMobSpawnerRendererMixin", + "mixins.TileEntityRendererDispatcherMixin", + "mixins.TileEntitySkullRendererMixin", + "mixins.VertexBufferMixin", + "mixins.VisGraphMixin", + "mixins.WorldClientMixin", + "mixins.WorldInfoMixin", + "mixins.WorldMixin", + "mixins.WorldRendererMixin" ] } \ No newline at end of file