mirror of
https://github.com/refactorinqq/SLC-1.8.9.git
synced 2024-11-10 07:01:32 +01:00
Update PlayerControllerMPMixin.java
This commit is contained in:
parent
adb5fa6b1c
commit
133c2a80fc
@ -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_);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user