Java 类net.minecraft.network.INetHandler 实例源码

项目:Mods    文件:UdpChannelHandlerClient.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
    ByteBuf buffer = msg.content();

    int seq = buffer.readUnsignedShort();
    int msgid = buffer.readByte();

    IMessage message = TF2weapons.network.messages[msgid].newInstance();
    //buffer.discardReadBytes();
    message.fromBytes(buffer);
    IMessageHandler<IMessage, IMessage> handler = TF2weapons.network.handlerList.get(message.getClass());
    if(constr == null) {
        constr =MessageContext.class.getDeclaredConstructor(INetHandler.class, Side.class);
        constr.setAccessible(true);
    }
    MessageContext context = constr.newInstance(Minecraft.getMinecraft().player.connection, Side.CLIENT); 
    handler.onMessage(message, context);
    System.out.println("PacketFrom: "+msg.sender().getAddress()+ " "+msg.sender().getPort()+" ");

}
项目:CustomWorldGen    文件:FMLProxyPacket.java   
/**
 * Passes this Packet on to the NetHandler for processing.
 */
@Override
public void processPacket(INetHandler inethandler)
{
    this.netHandler = inethandler;
    EmbeddedChannel internalChannel = NetworkRegistry.INSTANCE.getChannel(this.channel, this.target);
    if (internalChannel != null)
    {
        internalChannel.attr(NetworkRegistry.NET_HANDLER).set(this.netHandler);
        try
        {
            if (internalChannel.writeInbound(this))
            {
                badPackets.add(this.channel);
                if (badPackets.size() % packetCountWarning == 0)
                {
                    FMLLog.severe("Detected ongoing potential memory leak. %d packets have leaked. Top offenders", badPackets.size());
                    int i = 0;
                    for (Entry<String> s  : Multisets.copyHighestCountFirst(badPackets).entrySet())
                    {
                        if (i++ > 10) break;
                        FMLLog.severe("\t %s : %d", s.getElement(), s.getCount());
                    }
                }
            }
            internalChannel.inboundMessages().clear();
        }
        catch (FMLNetworkException ne)
        {
            FMLLog.log(Level.ERROR, ne, "There was a network exception handling a packet on channel %s", channel);
            dispatcher.rejectHandshake(ne.getMessage());
        }
        catch (Throwable t)
        {
            FMLLog.log(Level.ERROR, t, "There was a critical exception handling a packet on channel %s", channel);
            dispatcher.rejectHandshake("A fatal error has occurred, this connection is terminated");
        }
    }
}
项目:4Space-5    文件:GalacticraftPacketHandler.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, IPacket msg) throws Exception
{
    INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
    EntityPlayer player = GalacticraftCore.proxy.getPlayerFromNetHandler(netHandler);

    switch (FMLCommonHandler.instance().getEffectiveSide())
    {
    case CLIENT:
        msg.handleClientSide(player);
        break;
    case SERVER:
        msg.handleServerSide(player);
        break;
    default:
        break;
    }
}
项目:VivecraftForgeExtensions    文件:VivecraftForgePacketHandler.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, IPacket msg) throws Exception {
    INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
    EntityPlayer player = VivecraftForge.proxy.getPlayerFromNetHandler(netHandler);

    switch (FMLCommonHandler.instance().getEffectiveSide()) {
        case CLIENT:
            msg.handleClient(player);
            break;
        case SERVER:
            msg.handleServer(player);
            break;
        default:
            VivecraftForgeLog.severe("Impossible scenario encountered! Effective side is neither server nor client!");
            break;
    }
}
项目:Ambidextrous    文件:NetworkRouter.java   
@SuppressWarnings( "unchecked" )
public void onPacketData(
        final FMLProxyPacket packet,
        final INetHandler handler,
        final EntityPlayerMP playerEntity )
{
    if ( playerEntity == null )
    {
        return;
    }

    final PacketBuffer buffer = new PacketBuffer( packet.payload() );
    final ModPacket innerPacket = parsePacket( buffer );
    innerPacket.serverEntity = playerEntity;

    PacketThreadUtil.checkThreadAndEnqueue( innerPacket, handler, playerEntity.getServer() );
    innerPacket.server( playerEntity );
}
项目:NOVA-Core    文件:MCPacketHandler.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, PacketAbstract packet) throws Exception {
    INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();

    switch (FMLCommonHandler.instance().getEffectiveSide()) {
        case CLIENT:
            packet.handleClientSide(NovaMinecraft.proxy.getClientPlayer());
            break;
        case SERVER:
            packet.handleServerSide(((NetHandlerPlayServer) netHandler).playerEntity);
            break;
        default:
            break;
    }

}
项目:UsefulPets    文件:JumpPacketMonitor.java   
@Override
public void monitorIncoming( INetHandler net, net.minecraft.network.Packet packet )
{
    if ( !( net instanceof NetHandlerPlayServer ) || !( packet instanceof C0BPacketEntityAction ) )
    {
        return;
    }

    NetHandlerPlayServer server = ( NetHandlerPlayServer ) net;
    C0BPacketEntityAction action = ( C0BPacketEntityAction ) packet;

    if ( action.func_149513_d() != 6 || !( server.playerEntity.ridingEntity instanceof PetEntity ) )
    {
        return;
    }
    PetEntity pet = ( PetEntity ) server.playerEntity.ridingEntity;

    pet.setJumpingState( action.func_149512_e() );
}
项目:ClientAPI    文件:MixinNetworkManager.java   
@Redirect(method = "channelRead0", at = @At(value = "INVOKE", target = "net/minecraft/network/Packet.processPacket(Lnet/minecraft/network/INetHandler;)V"))
@SuppressWarnings("unchecked")
private void processPacket(Packet<?> packetIn, INetHandler handler) {
    PacketEvent event = new PacketEvent.Receive(packetIn);
    ClientAPI.EVENT_BUS.post(event);
    if (event.isCancelled())
        return;

    ((Packet<INetHandler>) event.getPacket()).processPacket(handler);
}
项目:Mods    文件:UdpChannelHandlerServer.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, DatagramPacket msg) throws Exception {
    ByteBuf buffer = msg.content();

    int plid = buffer.readShort();
    int seq = buffer.readUnsignedShort();
    int msgid = buffer.readByte();

    if(msgid == (byte)-128) {
        server.outboundTargets.put((short) plid, SocketUtils.socketAddress(msg.sender().getAddress().getHostAddress(),msg.sender().getPort()));
    }
    else {
        EntityPlayerMP player = server.playerList.get((short)plid);
        IMessage message = TF2weapons.network.messages[msgid].newInstance();
        //buffer.discardReadBytes();
        message.fromBytes(buffer);
        IMessageHandler<IMessage, IMessage> handler = TF2weapons.network.handlerList.get(message.getClass());
        if(constr == null) {
            constr =MessageContext.class.getDeclaredConstructor(INetHandler.class, Side.class);
            constr.setAccessible(true);
        }
        MessageContext context = constr.newInstance(player.connection, Side.SERVER); 
        handler.onMessage(message, context);
    }
    System.out.println("PacketFrom: "+msg.sender().getAddress()+ " "+msg.sender().getPort()+" ");

}
项目:CustomWorldGen    文件:FMLClientHandler.java   
@Override
public IThreadListener getWorldThread(INetHandler net)
{
    if (net instanceof INetHandlerPlayClient ||
        net instanceof INetHandlerLoginClient ||
        net instanceof INetHandlerStatusClient) return getClient();
    if (net instanceof INetHandlerHandshakeServer ||
        net instanceof INetHandlerLoginServer ||
        net instanceof INetHandlerPlayServer ||
        net instanceof INetHandlerStatusServer) return getServer();
    throw new RuntimeException("Unknown INetHandler: " + net);
}
项目:CustomWorldGen    文件:SimpleChannelHandlerWrapper.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, REQ msg) throws Exception
{
    INetHandler iNetHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
    MessageContext context = new MessageContext(iNetHandler, side);
    REPLY result = messageHandler.onMessage(msg, context);
    if (result != null)
    {
        ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.REPLY);
        ctx.writeAndFlush(result).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
    }
}
项目:ExtraUtilities    文件:ExtraUtilsClient.java   
@Override
public EntityPlayer getPlayerFromNetHandler(final INetHandler handler) {
    final EntityPlayer player = super.getPlayerFromNetHandler(handler);
    if (player == null) {
        return this.getClientPlayer();
    }
    return player;
}
项目:4Space-5    文件:PacketSimple.java   
@SideOnly(Side.CLIENT)
@Override
public void processPacket(INetHandler var1)
{
    if (this.type != EnumSimplePacket.C_UPDATE_SPACESTATION_LIST && this.type != EnumSimplePacket.C_UPDATE_PLANETS_LIST && this.type != EnumSimplePacket.C_UPDATE_CONFIGS)
    {
        return;
    }

    if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
    {
        this.handleClientSide(FMLClientHandler.instance().getClientPlayerEntity());
    }
}
项目:4Space-5    文件:CommonProxyCore.java   
public EntityPlayer getPlayerFromNetHandler(INetHandler handler)
{
    if (handler instanceof NetHandlerPlayServer)
    {
        return ((NetHandlerPlayServer) handler).playerEntity;
    }
    else
    {
        return null;
    }
}
项目:4Space-5    文件:ClientProxyCore.java   
@Override
public EntityPlayer getPlayerFromNetHandler(INetHandler handler)
{
    if (handler instanceof NetHandlerPlayServer)
    {
        return ((NetHandlerPlayServer) handler).playerEntity;
    }
    else
    {
        return FMLClientHandler.instance().getClientPlayerEntity();
    }
}
项目:4Space-5    文件:PacketCustom.java   
@Override
public void handle(INetHandler netHandler, String channel, PacketCustom packet) throws Exception {
    if (netHandler instanceof INetHandlerPlayClient)
        handler.handlePacket(packet, Minecraft.getMinecraft(), (INetHandlerPlayClient) netHandler);
    else
        System.err.println("Invalid INetHandler for PacketCustom on channel: " + channel);
}
项目:4Space-5    文件:PacketCustom.java   
@Override
public void handle(INetHandler netHandler, String channel, PacketCustom packet) throws Exception {
    if (netHandler instanceof NetHandlerPlayServer)
        handler.handlePacket(packet, ((NetHandlerPlayServer) netHandler).playerEntity, (INetHandlerPlayServer) netHandler);
    else
        System.err.println("Invalid INetHandler for PacketCustom on channel: " + channel);
}
项目:4Space-5    文件:PacketCustom.java   
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {
    if (evt instanceof NetworkHandshakeEstablished) {
        INetHandler netHandler = ((NetworkDispatcher) ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).get()).getNetHandler();
        if (netHandler instanceof NetHandlerPlayServer)
            handler.handshakeRecieved((NetHandlerPlayServer) netHandler);
    } else
        ctx.fireUserEventTriggered(evt);
}
项目:TRHS_Club_Mod_2016    文件:SimpleChannelHandlerWrapper.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, REQ msg) throws Exception
{
    INetHandler iNetHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
    MessageContext context = new MessageContext(iNetHandler, side);
    REPLY result = messageHandler.onMessage(msg, context);
    if (result != null)
    {
        ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.REPLY);
        ctx.writeAndFlush(result).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
    }
}
项目:TRHS_Club_Mod_2016    文件:FMLProxyPacket.java   
@Override
public void func_148833_a(INetHandler inethandler)
{
    this.netHandler = inethandler;
    EmbeddedChannel internalChannel = NetworkRegistry.INSTANCE.getChannel(this.channel, this.target);
    if (internalChannel != null)
    {
        internalChannel.attr(NetworkRegistry.NET_HANDLER).set(this.netHandler);
        try
        {
            if (internalChannel.writeInbound(this))
            {
                badPackets.add(this.channel);
                if (badPackets.size() % packetCountWarning == 0)
                {
                    FMLLog.severe("Detected ongoing potential memory leak. %d packets have leaked. Top offenders", badPackets.size());
                    int i = 0;
                    for (Entry<String> s  : Multisets.copyHighestCountFirst(badPackets).entrySet())
                    {
                        if (i++ > 10) break;
                        FMLLog.severe("\t %s : %d", s.getElement(), s.getCount());
                    }
                }
            }
            internalChannel.inboundMessages().clear();
        }
        catch (FMLNetworkException ne)
        {
            FMLLog.log(Level.ERROR, ne, "There was a network exception handling a packet on channel %s", channel);
            dispatcher.rejectHandshake(ne.getMessage());
        }
        catch (Throwable t)
        {
            FMLLog.log(Level.ERROR, t, "There was a critical exception handling a packet on channel %s", channel);
            dispatcher.rejectHandshake("A fatal error has occured, this connection is terminated");
        }
    }
}
项目:VivecraftForgeExtensions    文件:ProxyClient.java   
@Override
public EntityPlayer getPlayerFromNetHandler(INetHandler netHandler) {
    if (netHandler instanceof NetHandlerPlayServer) {
        return ((NetHandlerPlayServer)netHandler).playerEntity;
    }
    return FMLClientHandler.instance().getClientPlayerEntity();
}
项目:CodeChickenLib    文件:PacketCustom.java   
@Override
public void handle(final INetHandler netHandler, final String channel, final PacketCustom packet) {

    if (netHandler instanceof INetHandlerPlayClient) {
        Minecraft mc = Minecraft.getMinecraft();
        if (!mc.isCallingFromMinecraftThread()) {
            mc.addScheduledTask(() -> handle(netHandler, channel, packet));
        } else {
            handler.handlePacket(packet, mc, (INetHandlerPlayClient) netHandler);
        }
    } else {
        System.err.println("Invalid INetHandler for PacketCustom on channel: " + channel);
    }
}
项目:CodeChickenLib    文件:PacketCustom.java   
@Override
public void handle(final INetHandler netHandler, final String channel, final PacketCustom packet) {

    if (netHandler instanceof NetHandlerPlayServer) {
        MinecraftServer mc = FMLCommonHandler.instance().getMinecraftServerInstance();
        if (!mc.isCallingFromMinecraftThread()) {
            mc.addScheduledTask(() -> handle(netHandler, channel, packet));
        } else {
            handler.handlePacket(packet, ((NetHandlerPlayServer) netHandler).player, (INetHandlerPlayServer) netHandler);
        }
    } else {
        System.err.println("Invalid INetHandler for PacketCustom on channel: " + channel);
    }
}
项目:CodeChickenLib    文件:PacketCustom.java   
@Override
public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception {

    if (evt instanceof NetworkHandshakeEstablished) {
        INetHandler netHandler = ((NetworkDispatcher) ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGETARGS).get()).getNetHandler();
        if (netHandler instanceof NetHandlerPlayServer) {
            handler.handshakeReceived((NetHandlerPlayServer) netHandler);
        }
    } else {
        ctx.fireUserEventTriggered(evt);
    }
}
项目:ThermosRebased    文件:ImagineClientProxy.java   
@Override
public EntityPlayer obtainPlayer(final INetHandler handler) {
    EntityPlayer player = super.obtainPlayer(handler);
    if (player == null) {
        player = (EntityPlayer)Minecraft.func_71410_x().field_71439_g;
    }
    return player;
}
项目:ARKCraft    文件:ARKMessagePipeline.java   
@Override
protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception
{
    ByteBuf payload = msg.payload();
    byte discriminator = payload.readByte();
    Class<? extends ARKMessage> clazz = packets.get(discriminator);
    if (clazz == null) { throw new NullPointerException("No packet registered for discriminator: "
            + discriminator); }

    ARKMessage pkt = clazz.newInstance();
    pkt.decodeInto(ctx, payload.slice());

    EntityPlayer player;
    switch (FMLCommonHandler.instance().getEffectiveSide())
    {
        case CLIENT:
            player = getClientPlayer();
            pkt.handleClientSide(player);
            break;

        case SERVER:
            INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
            player = ((NetHandlerPlayServer) netHandler).playerEntity;
            pkt.handleServerSide(player);
            break;

        default:
    }

    out.add(pkt);
}
项目:Ambidextrous    文件:ModPacket.java   
@Override
public void processPacket(
        final INetHandler handler )
{
    if ( serverEntity == null )
    {
        client();
    }
    else
    {
        server( serverEntity );
    }
}
项目:Ambidextrous    文件:NetworkRouter.java   
@SuppressWarnings( "unchecked" )
public void onPacketData(
        final FMLProxyPacket packet,
        final INetHandler handler )
{
    final PacketBuffer buffer = new PacketBuffer( packet.payload() );
    final ModPacket innerPacket = parsePacket( buffer );

    PacketThreadUtil.checkThreadAndEnqueue( innerPacket, handler, Minecraft.getMinecraft() );
    innerPacket.client();
}
项目:Factorization    文件:HammerClientProxy.java   
@Override
public EntityPlayer getPlayerFrom(INetHandler netHandler) {
    if (netHandler instanceof NetHandlerPlayClient) {
        if (real_player != null) return real_player;
        return mc.thePlayer;
    }
    return super.getPlayerFrom(netHandler);
}
项目:Factorization    文件:HammerProxy.java   
public EntityPlayer getPlayerFrom(INetHandler netHandler) {
    if (netHandler instanceof NetHandlerPlayServer) {
        NetHandlerPlayServer nh = (NetHandlerPlayServer) netHandler;
        return nh.playerEntity;
    }
    return null;
}
项目:ItemDash    文件:LiteModItemDash.java   
@Override
public boolean handlePacket(INetHandler netHandler, Packet<?> packet) {
    if (!this.lastRequestedStack.isEmpty() && packet instanceof SPacketSetSlot) {
        SPacketSetSlot setslot = (SPacketSetSlot) packet;
        ItemStack stack = setslot.getStack();
        if (this.lastRequestedStack.isItemEqual(stack)) {
            this.pickSlot = true;
        }
    }
    return true;
}
项目:CauldronGit    文件:SimpleChannelHandlerWrapper.java   
@Override
protected void channelRead0(ChannelHandlerContext ctx, REQ msg) throws Exception
{
    INetHandler iNetHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
    MessageContext context = new MessageContext(iNetHandler, side);
    REPLY result = messageHandler.onMessage(msg, context);
    if (result != null)
    {
        ctx.channel().attr(FMLOutboundHandler.FML_MESSAGETARGET).set(FMLOutboundHandler.OutboundTarget.REPLY);
        ctx.writeAndFlush(result).addListener(ChannelFutureListener.FIRE_EXCEPTION_ON_FAILURE);
    }
}
项目:Logistic-Storage    文件:PacketManager.java   
public EntityPlayer getPlayer(INetHandler handler)
{
    if(handler instanceof NetHandlerPlayServer)
    {
        return ((NetHandlerPlayServer)handler).playerEntity;
    }
    return LogisticStorage.core.get().getPlayer();
}
项目:amunra    文件:ARPacketHandler.java   
protected EntityPlayer getPlayerFromNetHandler(INetHandler handler)
{
    if (handler instanceof NetHandlerPlayServer)
    {
        return ((NetHandlerPlayServer) handler).playerEntity;
    }
    else
    {
        return null;
    }
}
项目:amunra    文件:PacketSimpleAR.java   
@SideOnly(Side.CLIENT)
@Override
public void processPacket(INetHandler var1)
{
    /*
    if (this.type != EnumSimplePacket.C_UPDATE_SPACESTATION_LIST && this.type != EnumSimplePacket.C_UPDATE_PLANETS_LIST && this.type != EnumSimplePacket.C_UPDATE_CONFIGS)
    {
        return;
    }
     */
    if (FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
    {
        this.handleClientSide(FMLClientHandler.instance().getClientPlayerEntity());
    }/**/
}
项目:MHuanterMod    文件:MMMessagePipeline.java   
@Override
protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception {
    ByteBuf payload = msg.payload();
    byte discriminator = payload.readByte();
    Class<? extends MMMessage> clazz = packets.get(discriminator);
    if (clazz == null) {
        throw new NullPointerException("No packet registered for discriminator: " + discriminator);
    }

    MMMessage pkt = clazz.newInstance();
    pkt.decodeInto(ctx, payload.slice());

    EntityPlayer player;
    switch (FMLCommonHandler.instance().getEffectiveSide()) {
        case CLIENT:
            player = getClientPlayer();
            pkt.handleClientSide(player);
            break;

        case SERVER:
            INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
            player = ((NetHandlerPlayServer) netHandler).playerEntity;
            pkt.handleServerSide(player);
            break;

        default:
    }

    out.add(pkt);
}
项目:DynamicLib    文件:DynamicClientProxy.java   
@Override
public EntityPlayer getPlayerFromHandler(INetHandler handler) {
    if (handler instanceof NetHandlerPlayServer) return ((NetHandlerPlayServer) handler).playerEntity;

    if (handler instanceof NetHandlerPlayClient) return getThePlayer();

    return null;
}
项目:SpaceCore    文件:PacketInterceptor.java   
public static void intercept( INetHandler net, net.minecraft.network.Packet packet )
{
    //System.out.println("Incoming" );
    Iterator< IPacketMonitor > it = monitors.iterator();
    while ( it.hasNext() )
    {
        IPacketMonitor mon = it.next();
        mon.monitorIncoming( net, packet );
    }
}
项目:ARKCraft-Code    文件:ARKMessagePipeline.java   
@Override
protected void decode(ChannelHandlerContext ctx, FMLProxyPacket msg, List<Object> out) throws Exception
{
    ByteBuf payload = msg.payload();
    byte discriminator = payload.readByte();
    Class<? extends ARKMessage> clazz = packets.get(discriminator);
    if (clazz == null)
    {
        throw new NullPointerException("No packet registered for discriminator: " + discriminator);
    }

    ARKMessage pkt = clazz.newInstance();
    pkt.decodeInto(ctx, payload.slice());

    EntityPlayer player;
    switch (FMLCommonHandler.instance().getEffectiveSide())
    {
        case CLIENT:
            player = getClientPlayer();
            pkt.handleClientSide(player);
            break;

        case SERVER:
            INetHandler netHandler = ctx.channel().attr(NetworkRegistry.NET_HANDLER).get();
            player = ((NetHandlerPlayServer) netHandler).playerEntity;
            pkt.handleServerSide(player);
            break;

        default:
    }

    out.add(pkt);
}
项目:M4Armory    文件:AOEHandler.java   
public void mineBlock(World world, int x, int y, int z, int meta, EntityPlayer player, Block block)
{
    // Workaround for dropping experience
    boolean silktouch = EnchantmentHelper.getSilkTouchModifier(player);
    int fortune = EnchantmentHelper.getFortuneModifier(player);
    int exp = block.getExpDrop(world, meta, fortune);

    block.onBlockHarvested(world, x, y, z, meta, player);
    if (block.removedByPlayer(world, player, x, y, z, true))
    {
        block.onBlockDestroyedByPlayer(world, x, y, z, meta);
        block.harvestBlock(world, player, x, y, z, meta);
        // Workaround for dropping experience
        if (!silktouch)
            block.dropXpOnBlockBreak(world, x, y, z, exp);

        if (world.isRemote)
        {
            INetHandler handler = FMLClientHandler.instance().getClientPlayHandler();
            if (handler != null && handler instanceof NetHandlerPlayClient)
            {
                NetHandlerPlayClient handlerClient = (NetHandlerPlayClient) handler;
                handlerClient.addToSendQueue(new C07PacketPlayerDigging(0, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
                handlerClient.addToSendQueue(new C07PacketPlayerDigging(2, x, y, z, Minecraft.getMinecraft().objectMouseOver.sideHit));
            }
        }
    }
}