restrict to specific items
This commit is contained in:
1 parent
b1e52d59cf
commit
623ec21b93
1 file changed
+7
@@ -6,6 +6,8 @@ import net.minecraft.block.Block;
|
|||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.MinecraftClient;
|
import net.minecraft.client.MinecraftClient;
|
||||||
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
import net.minecraft.client.network.ClientPlayerInteractionManager;
|
||||||
|
import net.minecraft.item.ItemGroup;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.server.network.packet.PlayerInteractBlockC2SPacket;
|
import net.minecraft.server.network.packet.PlayerInteractBlockC2SPacket;
|
||||||
import net.minecraft.util.Hand;
|
import net.minecraft.util.Hand;
|
||||||
import net.minecraft.util.hit.BlockHitResult;
|
import net.minecraft.util.hit.BlockHitResult;
|
||||||
@@ -39,6 +41,11 @@ public abstract class ClientPlayerInteractionManager_ghostBlocksMixin
|
|||||||
blockState_1.getCollisionShape(iWorld_1, blockPos_1) != VoxelShapes.empty()
|
blockState_1.getCollisionShape(iWorld_1, blockPos_1) != VoxelShapes.empty()
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
ItemStack handItem = client.player.getMainHandStack();
|
||||||
|
if (handItem.isEmpty() ||
|
||||||
|
handItem.getItem().getGroup() == ItemGroup.TOOLS ||
|
||||||
|
handItem.getItem().getGroup() == ItemGroup.COMBAT
|
||||||
|
)
|
||||||
client.getNetworkHandler().sendPacket(new PlayerInteractBlockC2SPacket(
|
client.getNetworkHandler().sendPacket(new PlayerInteractBlockC2SPacket(
|
||||||
Hand.MAIN_HAND,
|
Hand.MAIN_HAND,
|
||||||
new BlockHitResult(new Vec3d(blockPos_1), Direction.DOWN, blockPos_1, false)
|
new BlockHitResult(new Vec3d(blockPos_1), Direction.DOWN, blockPos_1, false)
|
||||||
|
|||||||
Reference in new issue
Block a user