Search in sources :

Example 11 with ClientPlayNetworkHandler

use of net.minecraft.client.network.ClientPlayNetworkHandler in project Client by MatHax.

the class GhostCommand method execute.

private void execute(int radius) {
    ClientPlayNetworkHandler conn = mc.getNetworkHandler();
    if (conn == null)
        return;
    BlockPos pos = mc.player.getBlockPos();
    for (int dx = -radius; dx <= radius; dx++) for (int dy = -radius; dy <= radius; dy++) for (int dz = -radius; dz <= radius; dz++) {
        PlayerActionC2SPacket packet = new PlayerActionC2SPacket(PlayerActionC2SPacket.Action.ABORT_DESTROY_BLOCK, new BlockPos(pos.getX() + dx, pos.getY() + dy, pos.getZ() + dz), Direction.UP);
        conn.sendPacket(packet);
    }
}
Also used : PlayerActionC2SPacket(net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket) BlockPos(net.minecraft.util.math.BlockPos) ClientPlayNetworkHandler(net.minecraft.client.network.ClientPlayNetworkHandler)

Aggregations

ClientPlayNetworkHandler (net.minecraft.client.network.ClientPlayNetworkHandler)11 MinecraftClient (net.minecraft.client.MinecraftClient)4 IEClientPlayNetworkHandler (com.qouteall.immersive_portals.ducks.IEClientPlayNetworkHandler)3 IEClientWorld (com.qouteall.immersive_portals.ducks.IEClientWorld)3 PlayerActionC2SPacket (net.minecraft.network.packet.c2s.play.PlayerActionC2SPacket)3 ClientWorld (net.minecraft.client.world.ClientWorld)2 BlockPos (net.minecraft.util.math.BlockPos)2 Inject (org.spongepowered.asm.mixin.injection.Inject)2 GameProfile (com.mojang.authlib.GameProfile)1 MyClientChunkManager (com.qouteall.immersive_portals.chunk_loading.MyClientChunkManager)1 Portal (com.qouteall.immersive_portals.portal.Portal)1 Unpooled (io.netty.buffer.Unpooled)1 Contract (moriyashiine.bewitchment.api.registry.Contract)1 Bewitchment (moriyashiine.bewitchment.common.Bewitchment)1 BWComponents (moriyashiine.bewitchment.common.registry.BWComponents)1 BWRegistries (moriyashiine.bewitchment.common.registry.BWRegistries)1 PacketSender (net.fabricmc.fabric.api.networking.v1.PacketSender)1 ServerPlayNetworking (net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking)1 NbtType (net.fabricmc.fabric.api.util.NbtType)1 BlockState (net.minecraft.block.BlockState)1