This commit is contained in:
kirillsaint 2024-01-13 14:24:09 +06:00
parent f9cf54b43a
commit cf53cbd5d5
2 changed files with 15 additions and 2 deletions

View File

@ -59,7 +59,7 @@ import java.util.List;
public class Client {
public static final Logger logger = LogManager.getLogger("SC");
private final String version = "2.0.0";
private final String version = "2.0.1";
private static final Client INSTANCE = new Client();
public static final Client getInstance() {

View File

@ -1,11 +1,15 @@
package net.silentclient.client.mixin.mixins;
import net.minecraft.block.*;
import net.minecraft.block.state.IBlockState;
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 net.minecraft.util.BlockPos;
import net.minecraft.util.MovingObjectPosition;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Redirect;
@ -16,8 +20,17 @@ public class PlayerControllerMPMixin {
public void fixPacketSend(NetHandlerPlayClient instance, Packet p_147297_1_) {
ItemStack itemstack = Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem();
if(itemstack != null && (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)) {
if(Minecraft.getMinecraft().objectMouseOver != null && Minecraft.getMinecraft().objectMouseOver.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos();
IBlockState state = Minecraft.getMinecraft().theWorld.getBlockState(pos);
Block block = state.getBlock();
if(!(block instanceof BlockContainer || block instanceof BlockAnvil || block instanceof BlockWorkbench || block instanceof BlockBed || block instanceof BlockDoor || block instanceof BlockTrapDoor || block instanceof BlockButton || block instanceof BlockLever || block instanceof BlockRedstoneDiode)) {
return;
}
} else {
return;
}
}
instance.addToSendQueue(p_147297_1_);
}