Java 类net.minecraft.network.play.client.C07PacketPlayerDigging 实例源码

项目:EvenWurse    文件:FastBowMod.java   
@Override
public void onUpdate() {
    if (Minecraft.getMinecraft().thePlayer.getHealth() > 0 && (Minecraft.getMinecraft().thePlayer.onGround ||
            Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) &&
            Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem() != null &&
            Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem() instanceof ItemBow &&
            Minecraft.getMinecraft().gameSettings.keyBindUseItem.pressed) {
        Minecraft.getMinecraft().playerController
                .sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld,
                        Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem());
        Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem()
                .onItemRightClick(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
                        Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer);
        for (int i = 0; i < 20; i++) {
            Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(false));
        }
        Minecraft.getMinecraft().getNetHandler().addToSendQueue(
                new C07PacketPlayerDigging(Action.RELEASE_USE_ITEM, new BlockPos(0, 0, 0), EnumFacing.DOWN));
        Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem()
                .onPlayerStoppedUsing(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
                        Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer, 10);
    }
}
项目:Resilience-Client-Source    文件:ModuleClickNuker.java   
@Override
public void onBlockClicked(EventBlockClick event){
    if(!invoker.isInCreativeMode()) return;
    for(int y = (int) Resilience.getInstance().getValues().nukerRadius.getValue(); y >= (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); y--)
    {
        for(int z = (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); z <= Resilience.getInstance().getValues().nukerRadius.getValue(); z++)
        {
            for(int x = (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); x <= Resilience.getInstance().getValues().nukerRadius.getValue(); x++)
            {
                xPos = (int) Math.round(event.getX() + x);
                yPos = (int) ((int) Math.round(event.getY() + y));
                zPos = (int) Math.round(event.getZ() + z);

                Block block = invoker.getBlock(xPos, yPos, zPos);

                invoker.sendPacket(new C07PacketPlayerDigging(0, xPos, yPos, zPos, 1));
                invoker.sendPacket(new C07PacketPlayerDigging(2, xPos, yPos, zPos, 1));
            }
        }
    }
}
项目:Resilience-Client-Source    文件:ModuleFastBow.java   
@Override
public void onOutwardPacket(EventOnOutwardPacket event){
    if(!invoker.isOnGround()) return;
       Packet packet = event.getPacket();
       if (packet instanceof C08PacketPlayerBlockPlacement) {
        if(Item.getIdFromItem(invoker.getCurrentItem().getItem()) != 261) return;
           C08PacketPlayerBlockPlacement packetBlockPlacement = (C08PacketPlayerBlockPlacement) packet;
           if (packetBlockPlacement.func_149576_c() != -1 || packetBlockPlacement.func_149571_d() != -1 || packetBlockPlacement.func_149570_e() != -1 || packetBlockPlacement.func_149568_f() != 255) {
               return;
           }
           event.addPacketToList(new C09PacketHeldItemChange(Minecraft.getMinecraft().thePlayer.inventory.currentItem));
           for (int i = 0; i < 40; i++) {
            event.addPacketToList(new C03PacketPlayer(false));
           }

           event.addPacketToList(new C07PacketPlayerDigging(5, 0, 0, 0, 255));
       }
}
项目:Resilience-Client-Source    文件:ModuleFastEat.java   
@Override
public void onOutwardPacket(EventOnOutwardPacket event){
    if(!invoker.isOnGround()) return;
       Packet packet = event.getPacket();
       if (packet instanceof C08PacketPlayerBlockPlacement) {
        if(!(invoker.getCurrentItem().getItem() instanceof ItemFood)) return;
           C08PacketPlayerBlockPlacement packetBlockPlacement = (C08PacketPlayerBlockPlacement) packet;
           if (packetBlockPlacement.func_149576_c() != -1 || packetBlockPlacement.func_149571_d() != -1 || packetBlockPlacement.func_149570_e() != -1 || packetBlockPlacement.func_149568_f() != 255) {
               return;
           }
           event.addPacketToList(new C09PacketHeldItemChange(Minecraft.getMinecraft().thePlayer.inventory.currentItem));
           for (int i = 0; i < 40; i++) {
            event.addPacketToList(new C03PacketPlayer(false));
           }

           event.addPacketToList(new C07PacketPlayerDigging(5, 0, 0, 0, 255));
       }
}
项目:DecompiledMinecraft    文件:EntityPlayerSP.java   
/**
 * Called when player presses the drop item key
 */
public EntityItem dropOneItem(boolean dropAll)
{
    C07PacketPlayerDigging.Action c07packetplayerdigging$action = dropAll ? C07PacketPlayerDigging.Action.DROP_ALL_ITEMS : C07PacketPlayerDigging.Action.DROP_ITEM;
    this.sendQueue.addToSendQueue(new C07PacketPlayerDigging(c07packetplayerdigging$action, BlockPos.ORIGIN, EnumFacing.DOWN));
    return null;
}
项目:DecompiledMinecraft    文件:PlayerControllerMP.java   
/**
 * Resets current block damage and isHittingBlock
 */
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, EnumFacing.DOWN));
        this.isHittingBlock = false;
        this.curBlockDamageMP = 0.0F;
        this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, -1);
    }
}
项目:BaseClient    文件:FastBow.java   
@EventTarget
private void onPostUpdate(UpdateEvent event) {
    if (event.state == Event.State.PRE && this.mc.thePlayer.getItemInUse().getItem() instanceof ItemBow && this.mc.thePlayer.getItemInUseDuration() == 16) {
        int i = 0;
        while (i < 5) {
            this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C03PacketPlayer(true));
            ++i;
        }
        this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
        this.mc.thePlayer.stopUsingItem();
    }
}
项目:BaseClient    文件:FastUse.java   
@EventTarget
private void onPostUpdate(UpdateEvent event) {
    if (event.state == Event.State.PRE && this.mc.thePlayer.getItemInUseDuration() == 16 && !(this.mc.thePlayer.getItemInUse().getItem() instanceof ItemBow)) {
        int i = 0;
        while (i < 17) {
            this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C03PacketPlayer(true));
            ++i;
        }
        this.mc.getNetHandler().getNetworkManager().dispatchPacket((Packet)new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN), null);
    }
}
项目:BaseClient    文件:NoSlowdown.java   
@EventTarget(value=4)
private void onUpdate(UpdateEvent event) {
    if (this.mc.thePlayer.isBlocking() && (this.mc.thePlayer.motionX != 0.0 || this.mc.thePlayer.motionZ != 0.0)) {
        if (event.state == Event.State.PRE) {
            this.mc.getNetHandler().getNetworkManager().dispatchPacket((Packet)new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN), null);
        } else if (event.state == Event.State.POST) {
            this.mc.thePlayer.sendQueue.addToSendQueue((Packet)new C08PacketPlayerBlockPlacement(this.mc.thePlayer.inventory.getCurrentItem()));
        }
    }
}
项目:BaseClient    文件:EntityPlayerSP.java   
/**
 * Called when player presses the drop item key
 */
public EntityItem dropOneItem(boolean dropAll)
{
    C07PacketPlayerDigging.Action c07packetplayerdigging$action = dropAll ? C07PacketPlayerDigging.Action.DROP_ALL_ITEMS : C07PacketPlayerDigging.Action.DROP_ITEM;
    this.sendQueue.addToSendQueue(new C07PacketPlayerDigging(c07packetplayerdigging$action, BlockPos.ORIGIN, EnumFacing.DOWN));
    return null;
}
项目:BaseClient    文件:PlayerControllerMP.java   
/**
 * Resets current block damage and isHittingBlock
 */
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, EnumFacing.DOWN));
        this.isHittingBlock = false;
        this.curBlockDamageMP = 0.0F;
        this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, -1);
    }
}
项目:BaseClient    文件:EntityPlayerSP.java   
/**
 * Called when player presses the drop item key
 */
public EntityItem dropOneItem(boolean dropAll) {
    C07PacketPlayerDigging.Action c07packetplayerdigging$action = dropAll
            ? C07PacketPlayerDigging.Action.DROP_ALL_ITEMS
            : C07PacketPlayerDigging.Action.DROP_ITEM;
    this.sendQueue.addToSendQueue(
            new C07PacketPlayerDigging(c07packetplayerdigging$action, BlockPos.ORIGIN, EnumFacing.DOWN));
    return null;
}
项目:BaseClient    文件:PlayerControllerMP.java   
/**
 * Resets current block damage and isHittingBlock
 */
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, EnumFacing.DOWN));
        this.isHittingBlock = false;
        this.curBlockDamageMP = 0.0F;
        this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, -1);
    }
}
项目:4Space-5    文件:PlayerControllerMP.java   
public void clickBlock(int p_78743_1_, int p_78743_2_, int p_78743_3_, int p_78743_4_)
{
    if ((!this.currentGameType.isAdventure()) || (this.mc.thePlayer.isCurrentToolAdventureModeExempt(p_78743_1_, p_78743_2_, p_78743_3_))) {
        if (this.currentGameType.isCreative())
        {
            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(0, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_));
            clickBlockCreative(this.mc, this, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_);
            this.blockHitDelay = 5;
        }
        else if ((!this.isHittingBlock) || (!sameToolAndBlock(p_78743_1_, p_78743_2_, p_78743_3_)))
        {
            if (this.isHittingBlock) {
                this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, p_78743_4_));
            }
            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(0, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_));
            Block block = this.mc.theWorld.getBlock(p_78743_1_, p_78743_2_, p_78743_3_);
            boolean flag = block.getMaterial() != Material.air;
            if ((flag) && (this.curBlockDamageMP == 0.0F)) {
                block.onBlockClicked(this.mc.theWorld, p_78743_1_, p_78743_2_, p_78743_3_, this.mc.thePlayer);
            }
            if ((flag) && (block.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, p_78743_1_, p_78743_2_, p_78743_3_) >= 1.0F))
            {
                onPlayerDestroyBlock(p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_);
            }
            else
            {
                this.isHittingBlock = true;
                this.currentBlockX = p_78743_1_;
                this.currentBlockY = p_78743_2_;
                this.currentblockZ = p_78743_3_;
                this.currentItemHittingBlock = this.mc.thePlayer.getHeldItem();
                this.curBlockDamageMP = 0.0F;
                this.stepSoundTickCounter = 0.0F;
                this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, (int)(this.curBlockDamageMP * 10.0F) - 1);
            }
        }
    }
}
项目:4Space-5    文件:PlayerControllerMP.java   
public void resetBlockRemoving()
{
    if (this.isHittingBlock) {
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, -1));
    }
    this.isHittingBlock = false;
    this.curBlockDamageMP = 0.0F;
    this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, -1);
}
项目:EvenWurse    文件:BowSpamMod.java   
@Override
public void onUpdate() {
    if (Minecraft.getMinecraft().thePlayer.getHealth() > 0 && (Minecraft.getMinecraft().thePlayer.onGround ||
            Minecraft.getMinecraft().thePlayer.capabilities.isCreativeMode) &&
            Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem() != null &&
            Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem() instanceof ItemBow &&
            Minecraft.getMinecraft().gameSettings.keyBindUseItem.pressed) {
        new Thread(() -> {
            Minecraft.getMinecraft().playerController
                    .sendUseItem(Minecraft.getMinecraft().thePlayer, Minecraft.getMinecraft().theWorld,
                            Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem());
            Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem()
                    .onItemRightClick(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
                            Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer);
            String configKey = "Charge Level (1 - 20)";
            int iters = ModuleConfiguration.forModule(this).getInt(configKey, 3);
            if (iters > 20 || iters < 1) {
                iters = 1;
                Chat.sendWarning("BowSpam charge level range out of range, resetting!");
                ModuleConfiguration.forModule(this).putString(configKey, String.valueOf(iters));
            }
            for (int i = 0; i < iters; i++) {
                try {
                    Thread.sleep(ModuleConfiguration.forModule(this).getInt("Delay between charges (ms)", 10));
                } catch (InterruptedException ignored) {
                }
                Minecraft.getMinecraft().thePlayer.sendQueue.addToSendQueue(new C03PacketPlayer(false));
            }
            Minecraft.getMinecraft().getNetHandler().addToSendQueue(
                    new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM,
                            new BlockPos(0, 0, 0), EnumFacing.DOWN));
            Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem().getItem()
                    .onPlayerStoppedUsing(Minecraft.getMinecraft().thePlayer.inventory.getCurrentItem(),
                            Minecraft.getMinecraft().theWorld, Minecraft.getMinecraft().thePlayer, 10);
        }).start();
    }
}
项目:EvenWurse    文件:NukerMod.java   
private void nukeAll() {
    for (int y = (int) realRange; y >= (mode == 2 ? 0 : -realRange); y--) {
        for (int x = (int) realRange; x >= -realRange - 1; x--) {
            for (int z = (int) realRange; z >= -realRange; z--) {
                int posX = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posX) + x);
                int posY = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posY) + y);
                int posZ = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + z);
                BlockPos blockPos = new BlockPos(posX, posY, posZ);
                Block block = Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock();
                float xDiff = (float) (Minecraft.getMinecraft().thePlayer.posX - posX);
                float yDiff = (float) (Minecraft.getMinecraft().thePlayer.posY - posY);
                float zDiff = (float) (Minecraft.getMinecraft().thePlayer.posZ - posZ);
                float currentDistance = BlockUtils.getBlockDistance(xDiff, yDiff, zDiff);
                MovingObjectPosition fakeObjectMouseOver = Minecraft.getMinecraft().objectMouseOver;
                if (fakeObjectMouseOver == null) return;
                fakeObjectMouseOver.setBlockPos(blockPos);
                if (Block.getIdFromBlock(block) != 0 && posY >= 0 && currentDistance <= realRange) {
                    if (mode == 1 && Block.getIdFromBlock(block) != id) continue;
                    if (mode == 3 && block.getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer,
                            Minecraft.getMinecraft().theWorld, blockPos) < 1) {
                        continue;
                    }
                    side = fakeObjectMouseOver.sideHit;
                    shouldRenderESP = true;
                    BlockUtils.faceBlockPacket(pos);
                    Minecraft.getMinecraft().thePlayer.sendQueue
                            .addToSendQueue(new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, blockPos, side));
                    block.onBlockDestroyedByPlayer(Minecraft.getMinecraft().theWorld, blockPos,
                            Minecraft.getMinecraft().theWorld.getBlockState(blockPos));
                }
            }
        }
    }
}
项目:EvenWurse    文件:TunnellerMod.java   
private void nukeAll() {
    for (int y = 2; y >= 0; y--) {
        for (int x = 1; x >= -1; x--) {
            for (int z = 1; z >= -1; z--) {
                int posX = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posX) + x);
                int posY = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posY) + y);
                int posZ = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + z);
                BlockPos blockPos = new BlockPos(posX, posY, posZ);
                Block block = Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock();
                MovingObjectPosition fakeObjectMouseOver = Minecraft.getMinecraft().objectMouseOver;
                fakeObjectMouseOver.setBlockPos(blockPos);
                if (Block.getIdFromBlock(block) != 0 && posY >= 0) {
                    if (WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).getMode() == 3 &&
                            block.getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer,
                                    Minecraft.getMinecraft().theWorld, blockPos) < 1) {
                        continue;
                    }
                    side = fakeObjectMouseOver.sideHit;
                    shouldRenderESP = true;
                    BlockUtils.faceBlockPacket(pos);
                    Minecraft.getMinecraft().thePlayer.sendQueue
                            .addToSendQueue(new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, blockPos, side));
                    block.onBlockDestroyedByPlayer(Minecraft.getMinecraft().theWorld, blockPos,
                            Minecraft.getMinecraft().theWorld.getBlockState(blockPos));
                }
            }
        }
    }
}
项目:EvenWurse    文件:SpeedNukerMod.java   
private void nukeAll() {
    int nukerMode = WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).getMode();
    for (int y = (int) WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).normalRange;
         y >= (nukerMode == 2 ? 0 : -WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).normalRange); y--) {
        for (int x = (int) WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).normalRange;
             x >= -WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).normalRange - 1; x--) {
            for (int z = (int) WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).normalRange;
                 z >= -WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).normalRange; z--) {
                int posX = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posX) + x);
                int posY = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posY) + y);
                int posZ = (int) (Math.floor(Minecraft.getMinecraft().thePlayer.posZ) + z);
                if (x == 0 && y == -1 && z == 0) continue;
                BlockPos blockPos = new BlockPos(posX, posY, posZ);
                Block block = Minecraft.getMinecraft().theWorld.getBlockState(blockPos).getBlock();
                float xDiff = (float) (Minecraft.getMinecraft().thePlayer.posX - posX);
                float yDiff = (float) (Minecraft.getMinecraft().thePlayer.posY - posY);
                float zDiff = (float) (Minecraft.getMinecraft().thePlayer.posZ - posZ);
                float currentDistance = BlockUtils.getBlockDistance(xDiff, yDiff, zDiff);
                MovingObjectPosition fakeObjectMouseOver = Minecraft.getMinecraft().objectMouseOver;
                fakeObjectMouseOver.setBlockPos(new BlockPos(posX, posY, posZ));
                if (Block.getIdFromBlock(block) != 0 && posY >= 0 &&
                        currentDistance <= WurstClient.INSTANCE.mods.getModByClass(NukerMod.class).normalRange) {
                    if (nukerMode == 1 && Block.getIdFromBlock(block) != NukerMod.id) {
                        continue;
                    }
                    if (nukerMode == 3 && block.getPlayerRelativeBlockHardness(Minecraft.getMinecraft().thePlayer,
                            Minecraft.getMinecraft().theWorld, blockPos) < 1) {
                        continue;
                    }
                    if (!Minecraft.getMinecraft().thePlayer.onGround) continue;
                    EnumFacing side = fakeObjectMouseOver.sideHit;
                    Minecraft.getMinecraft().thePlayer.sendQueue
                            .addToSendQueue(new C07PacketPlayerDigging(Action.START_DESTROY_BLOCK, blockPos, side));
                    Minecraft.getMinecraft().thePlayer.sendQueue
                            .addToSendQueue(new C07PacketPlayerDigging(Action.STOP_DESTROY_BLOCK, blockPos, side));
                }
            }
        }
    }
}
项目:Resilience-Client-Source    文件:ModuleNuker.java   
@Override
public void onUpdate(EventOnUpdate event){
    shouldSelect = !invoker.isInCreativeMode();
    positions.clear();

    for(int y = (int) Resilience.getInstance().getValues().nukerRadius.getValue(); y >= (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); y--)
    {
        for(int z = (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); z <= Resilience.getInstance().getValues().nukerRadius.getValue(); z++)
        {
            for(int x = (int) -Resilience.getInstance().getValues().nukerRadius.getValue(); x <= Resilience.getInstance().getValues().nukerRadius.getValue(); x++)
            {
                xPos = (int) Math.round(invoker.getPosX() + x);
                yPos = (int) ((int) Math.round(invoker.getPosY() + y)-invoker.getEntityHeight(Resilience.getInstance().getWrapper().getPlayer())/2);
                zPos = (int) Math.round(invoker.getPosZ() + z);

                Block block = invoker.getBlock(xPos, yPos, zPos);

                if(shouldSelect){
                    if(block != null && selected != null && invoker.getIdFromBlock(selected) == invoker.getIdFromBlock(block)){
                        positions.add(new Integer[]{xPos, yPos, zPos});
                        invoker.sendPacket(new C07PacketPlayerDigging(0, xPos, yPos, zPos, 1));
                        invoker.sendPacket(new C07PacketPlayerDigging(2, xPos, yPos, zPos, 1));
                    }
                }else{
                    if(invoker.getIdFromBlock(block) != 0)
                    {
                        positions.add(new Integer[]{xPos, yPos, zPos});
                        invoker.sendPacket(new C07PacketPlayerDigging(0, xPos, yPos, zPos, 1));
                        invoker.sendPacket(new C07PacketPlayerDigging(2, xPos, yPos, zPos, 1));
                    }   
                }
            }
        }
    }
}
项目:Resilience-Client-Source    文件:EntityClientPlayerMP.java   
/**
 * Called when player presses the drop item key
 */
public EntityItem dropOneItem(boolean par1)
{
    int var2 = par1 ? 3 : 4;
    this.sendQueue.addToSendQueue(new C07PacketPlayerDigging(var2, 0, 0, 0, 0));
    return null;
}
项目:Resilience-Client-Source    文件:PlayerControllerMP.java   
/**
 * Resets current block damage and isHittingBlock
 */
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, -1));
    }

    this.isHittingBlock = false;
    this.curBlockDamageMP = 0.0F;
    this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, -1);
}
项目: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));
            }
        }
    }
}
项目:4Space-1.7    文件:PlayerControllerMP.java   
public void clickBlock(int p_78743_1_, int p_78743_2_, int p_78743_3_, int p_78743_4_)
{
    if ((!this.currentGameType.isAdventure()) || (this.mc.thePlayer.isCurrentToolAdventureModeExempt(p_78743_1_, p_78743_2_, p_78743_3_))) {
        if (this.currentGameType.isCreative())
        {
            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(0, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_));
            clickBlockCreative(this.mc, this, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_);
            this.blockHitDelay = 5;
        }
        else if ((!this.isHittingBlock) || (!sameToolAndBlock(p_78743_1_, p_78743_2_, p_78743_3_)))
        {
            if (this.isHittingBlock) {
                this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, p_78743_4_));
            }
            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(0, p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_));
            Block block = this.mc.theWorld.getBlock(p_78743_1_, p_78743_2_, p_78743_3_);
            boolean flag = block.getMaterial() != Material.air;
            if ((flag) && (this.curBlockDamageMP == 0.0F)) {
                block.onBlockClicked(this.mc.theWorld, p_78743_1_, p_78743_2_, p_78743_3_, this.mc.thePlayer);
            }
            if ((flag) && (block.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, p_78743_1_, p_78743_2_, p_78743_3_) >= 1.0F))
            {
                onPlayerDestroyBlock(p_78743_1_, p_78743_2_, p_78743_3_, p_78743_4_);
            }
            else
            {
                this.isHittingBlock = true;
                this.currentBlockX = p_78743_1_;
                this.currentBlockY = p_78743_2_;
                this.currentblockZ = p_78743_3_;
                this.currentItemHittingBlock = this.mc.thePlayer.getHeldItem();
                this.curBlockDamageMP = 0.0F;
                this.stepSoundTickCounter = 0.0F;
                this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, (int)(this.curBlockDamageMP * 10.0F) - 1);
            }
        }
    }
}
项目:4Space-1.7    文件:PlayerControllerMP.java   
public void resetBlockRemoving()
{
    if (this.isHittingBlock) {
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, -1));
    }
    this.isHittingBlock = false;
    this.curBlockDamageMP = 0.0F;
    this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, -1);
}
项目:ToolUtilities    文件: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));
            }
        }
        else if (Config.noisyBlocks)
        {
            world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12));
        }
    }
}
项目:Cauldron    文件:PlayerControllerMP.java   
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, -1));
    }

    this.isHittingBlock = false;
    this.curBlockDamageMP = 0.0F;
    this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, -1);
}
项目:Cauldron    文件:PlayerControllerMP.java   
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(1, this.currentBlockX, this.currentBlockY, this.currentblockZ, -1));
    }

    this.isHittingBlock = false;
    this.curBlockDamageMP = 0.0F;
    this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, -1);
}
项目:DecompiledMinecraft    文件:PlayerControllerMP.java   
/**
 * Called when the player is hitting a block with an item.
 */
public boolean clickBlock(BlockPos loc, EnumFacing face)
{
    if (this.currentGameType.isAdventure())
    {
        if (this.currentGameType == WorldSettings.GameType.SPECTATOR)
        {
            return false;
        }

        if (!this.mc.thePlayer.isAllowEdit())
        {
            Block block = this.mc.theWorld.getBlockState(loc).getBlock();
            ItemStack itemstack = this.mc.thePlayer.getCurrentEquippedItem();

            if (itemstack == null)
            {
                return false;
            }

            if (!itemstack.canDestroy(block))
            {
                return false;
            }
        }
    }

    if (!this.mc.theWorld.getWorldBorder().contains(loc))
    {
        return false;
    }
    else
    {
        if (this.currentGameType.isCreative())
        {
            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, loc, face));
            clickBlockCreative(this.mc, this, loc, face);
            this.blockHitDelay = 5;
        }
        else if (!this.isHittingBlock || !this.isHittingPosition(loc))
        {
            if (this.isHittingBlock)
            {
                this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, face));
            }

            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, loc, face));
            Block block1 = this.mc.theWorld.getBlockState(loc).getBlock();
            boolean flag = block1.getMaterial() != Material.air;

            if (flag && this.curBlockDamageMP == 0.0F)
            {
                block1.onBlockClicked(this.mc.theWorld, loc, this.mc.thePlayer);
            }

            if (flag && block1.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, loc) >= 1.0F)
            {
                this.onPlayerDestroyBlock(loc, face);
            }
            else
            {
                this.isHittingBlock = true;
                this.currentBlock = loc;
                this.currentItemHittingBlock = this.mc.thePlayer.getHeldItem();
                this.curBlockDamageMP = 0.0F;
                this.stepSoundTickCounter = 0.0F;
                this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
            }
        }

        return true;
    }
}
项目:DecompiledMinecraft    文件:PlayerControllerMP.java   
public boolean onPlayerDamageBlock(BlockPos posBlock, EnumFacing directionFacing)
{
    this.syncCurrentPlayItem();

    if (this.blockHitDelay > 0)
    {
        --this.blockHitDelay;
        return true;
    }
    else if (this.currentGameType.isCreative() && this.mc.theWorld.getWorldBorder().contains(posBlock))
    {
        this.blockHitDelay = 5;
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, posBlock, directionFacing));
        clickBlockCreative(this.mc, this, posBlock, directionFacing);
        return true;
    }
    else if (this.isHittingPosition(posBlock))
    {
        Block block = this.mc.theWorld.getBlockState(posBlock).getBlock();

        if (block.getMaterial() == Material.air)
        {
            this.isHittingBlock = false;
            return false;
        }
        else
        {
            this.curBlockDamageMP += block.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, posBlock);

            if (this.stepSoundTickCounter % 4.0F == 0.0F)
            {
                this.mc.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(block.stepSound.getStepSound()), (block.stepSound.getVolume() + 1.0F) / 8.0F, block.stepSound.getFrequency() * 0.5F, (float)posBlock.getX() + 0.5F, (float)posBlock.getY() + 0.5F, (float)posBlock.getZ() + 0.5F));
            }

            ++this.stepSoundTickCounter;

            if (this.curBlockDamageMP >= 1.0F)
            {
                this.isHittingBlock = false;
                this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, posBlock, directionFacing));
                this.onPlayerDestroyBlock(posBlock, directionFacing);
                this.curBlockDamageMP = 0.0F;
                this.stepSoundTickCounter = 0.0F;
                this.blockHitDelay = 5;
            }

            this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
            return true;
        }
    }
    else
    {
        return this.clickBlock(posBlock, directionFacing);
    }
}
项目:DecompiledMinecraft    文件:PlayerControllerMP.java   
public void onStoppedUsingItem(EntityPlayer playerIn)
{
    this.syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
    playerIn.stopUsingItem();
}
项目:BaseClient    文件:PlayerControllerMP.java   
/**
 * Called when the player is hitting a block with an item.
 */
public boolean clickBlock(BlockPos loc, EnumFacing face)
{
    if (this.currentGameType.isAdventure())
    {
        if (this.currentGameType == WorldSettings.GameType.SPECTATOR)
        {
            return false;
        }

        if (!this.mc.thePlayer.isAllowEdit())
        {
            Block block = this.mc.theWorld.getBlockState(loc).getBlock();
            ItemStack itemstack = this.mc.thePlayer.getCurrentEquippedItem();

            if (itemstack == null)
            {
                return false;
            }

            if (!itemstack.canDestroy(block))
            {
                return false;
            }
        }
    }

    if (!this.mc.theWorld.getWorldBorder().contains(loc))
    {
        return false;
    }
    else
    {
        if (this.currentGameType.isCreative())
        {
            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, loc, face));
            clickBlockCreative(this.mc, this, loc, face);
            this.blockHitDelay = 5;
        }
        else if (!this.isHittingBlock || !this.isHittingPosition(loc))
        {
            if (this.isHittingBlock)
            {
                this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, face));
            }

            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, loc, face));
            Block block1 = this.mc.theWorld.getBlockState(loc).getBlock();
            boolean flag = block1.getMaterial() != Material.air;

            if (flag && this.curBlockDamageMP == 0.0F)
            {
                block1.onBlockClicked(this.mc.theWorld, loc, this.mc.thePlayer);
            }

            if (flag && block1.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, loc) >= 1.0F)
            {
                this.onPlayerDestroyBlock(loc, face);
            }
            else
            {
                this.isHittingBlock = true;
                this.currentBlock = loc;
                this.currentItemHittingBlock = this.mc.thePlayer.getHeldItem();
                this.curBlockDamageMP = 0.0F;
                this.stepSoundTickCounter = 0.0F;
                this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
            }
        }

        return true;
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
public boolean onPlayerDamageBlock(BlockPos posBlock, EnumFacing directionFacing)
{
    this.syncCurrentPlayItem();

    if (this.blockHitDelay > 0)
    {
        --this.blockHitDelay;
        return true;
    }
    else if (this.currentGameType.isCreative() && this.mc.theWorld.getWorldBorder().contains(posBlock))
    {
        this.blockHitDelay = 5;
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, posBlock, directionFacing));
        clickBlockCreative(this.mc, this, posBlock, directionFacing);
        return true;
    }
    else if (this.isHittingPosition(posBlock))
    {
        Block block = this.mc.theWorld.getBlockState(posBlock).getBlock();

        if (block.getMaterial() == Material.air)
        {
            this.isHittingBlock = false;
            return false;
        }
        else
        {
            this.curBlockDamageMP += block.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, posBlock);

            if (this.stepSoundTickCounter % 4.0F == 0.0F)
            {
                this.mc.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(block.stepSound.getStepSound()), (block.stepSound.getVolume() + 1.0F) / 8.0F, block.stepSound.getFrequency() * 0.5F, (float)posBlock.getX() + 0.5F, (float)posBlock.getY() + 0.5F, (float)posBlock.getZ() + 0.5F));
            }

            ++this.stepSoundTickCounter;

            if (this.curBlockDamageMP >= 1.0F)
            {
                this.isHittingBlock = false;
                this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, posBlock, directionFacing));
                this.onPlayerDestroyBlock(posBlock, directionFacing);
                this.curBlockDamageMP = 0.0F;
                this.stepSoundTickCounter = 0.0F;
                this.blockHitDelay = 5;
            }

            this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
            return true;
        }
    }
    else
    {
        return this.clickBlock(posBlock, directionFacing);
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
public void onStoppedUsingItem(EntityPlayer playerIn)
{
    this.syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
    playerIn.stopUsingItem();
}
项目:BaseClient    文件:PlayerControllerMP.java   
/**
 * Called when the player is hitting a block with an item.
 */
public boolean clickBlock(BlockPos loc, EnumFacing face)
{
    if (this.currentGameType.isAdventure())
    {
        if (this.currentGameType == WorldSettings.GameType.SPECTATOR)
        {
            return false;
        }

        if (!this.mc.thePlayer.isAllowEdit())
        {
            Block block = this.mc.theWorld.getBlockState(loc).getBlock();
            ItemStack itemstack = this.mc.thePlayer.getCurrentEquippedItem();

            if (itemstack == null)
            {
                return false;
            }

            if (!itemstack.canDestroy(block))
            {
                return false;
            }
        }
    }

    if (!this.mc.theWorld.getWorldBorder().contains(loc))
    {
        return false;
    }
    else
    {
        if (this.currentGameType.isCreative())
        {
            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, loc, face));
            clickBlockCreative(this.mc, this, loc, face);
            this.blockHitDelay = 5;
        }
        else if (!this.isHittingBlock || !this.isHittingPosition(loc))
        {
            if (this.isHittingBlock)
            {
                this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, face));
            }

            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, loc, face));
            Block block1 = this.mc.theWorld.getBlockState(loc).getBlock();
            boolean flag = block1.getMaterial() != Material.air;

            if (flag && this.curBlockDamageMP == 0.0F)
            {
                block1.onBlockClicked(this.mc.theWorld, loc, this.mc.thePlayer);
            }

            if (flag && block1.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, loc) >= 1.0F)
            {
                this.onPlayerDestroyBlock(loc, face);
            }
            else
            {
                this.isHittingBlock = true;
                this.currentBlock = loc;
                this.currentItemHittingBlock = this.mc.thePlayer.getHeldItem();
                this.curBlockDamageMP = 0.0F;
                this.stepSoundTickCounter = 0.0F;
                this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
            }
        }

        return true;
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
public boolean onPlayerDamageBlock(BlockPos posBlock, EnumFacing directionFacing)
{
    this.syncCurrentPlayItem();

    if (this.blockHitDelay > 0)
    {
        --this.blockHitDelay;
        return true;
    }
    else if (this.currentGameType.isCreative() && this.mc.theWorld.getWorldBorder().contains(posBlock))
    {
        this.blockHitDelay = 5;
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK, posBlock, directionFacing));
        clickBlockCreative(this.mc, this, posBlock, directionFacing);
        return true;
    }
    else if (this.isHittingPosition(posBlock))
    {
        Block block = this.mc.theWorld.getBlockState(posBlock).getBlock();

        if (block.getMaterial() == Material.air)
        {
            this.isHittingBlock = false;
            return false;
        }
        else
        {
            this.curBlockDamageMP += block.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, posBlock);

            if (this.stepSoundTickCounter % 4.0F == 0.0F)
            {
                this.mc.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(block.stepSound.getStepSound()), (block.stepSound.getVolume() + 1.0F) / 8.0F, block.stepSound.getFrequency() * 0.5F, (float)posBlock.getX() + 0.5F, (float)posBlock.getY() + 0.5F, (float)posBlock.getZ() + 0.5F));
            }

            ++this.stepSoundTickCounter;

            if (this.curBlockDamageMP >= 1.0F)
            {
                this.isHittingBlock = false;
                this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, posBlock, directionFacing));
                this.onPlayerDestroyBlock(posBlock, directionFacing);
                this.curBlockDamageMP = 0.0F;
                this.stepSoundTickCounter = 0.0F;
                this.blockHitDelay = 5;
            }

            this.mc.theWorld.sendBlockBreakProgress(this.mc.thePlayer.getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
            return true;
        }
    }
    else
    {
        return this.clickBlock(posBlock, directionFacing);
    }
}
项目:BaseClient    文件:PlayerControllerMP.java   
public void onStoppedUsingItem(EntityPlayer playerIn)
{
    this.syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
    playerIn.stopUsingItem();
}
项目:4Space-5    文件:PlayerControllerMP.java   
public void onPlayerDamageBlock(int p_78759_1_, int p_78759_2_, int p_78759_3_, int p_78759_4_)
{
    syncCurrentPlayItem();
    if (this.blockHitDelay > 0)
    {
        this.blockHitDelay -= 1;
    }
    else if (this.currentGameType.isCreative())
    {
        this.blockHitDelay = 5;
        this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(0, p_78759_1_, p_78759_2_, p_78759_3_, p_78759_4_));
        clickBlockCreative(this.mc, this, p_78759_1_, p_78759_2_, p_78759_3_, p_78759_4_);
    }
    else if (sameToolAndBlock(p_78759_1_, p_78759_2_, p_78759_3_))
    {
        Block block = this.mc.theWorld.getBlock(p_78759_1_, p_78759_2_, p_78759_3_);
        if (block.getMaterial() == Material.air)
        {
            this.isHittingBlock = false;
            return;
        }
        this.curBlockDamageMP += block.getPlayerRelativeBlockHardness(this.mc.thePlayer, this.mc.thePlayer.worldObj, p_78759_1_, p_78759_2_, p_78759_3_);
        if (this.stepSoundTickCounter % 4.0F == 0.0F) {
            this.mc.getSoundHandler().playSound(new PositionedSoundRecord(new ResourceLocation(block.stepSound.getStepResourcePath()), (block.stepSound.getVolume() + 1.0F) / 8.0F, block.stepSound.getPitch() * 0.5F, p_78759_1_ + 0.5F, p_78759_2_ + 0.5F, p_78759_3_ + 0.5F));
        }
        this.stepSoundTickCounter += 1.0F;
        if (this.curBlockDamageMP >= 1.0F)
        {
            this.isHittingBlock = false;
            this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(2, p_78759_1_, p_78759_2_, p_78759_3_, p_78759_4_));
            onPlayerDestroyBlock(p_78759_1_, p_78759_2_, p_78759_3_, p_78759_4_);
            this.curBlockDamageMP = 0.0F;
            this.stepSoundTickCounter = 0.0F;
            this.blockHitDelay = 5;
        }
        this.mc.theWorld.destroyBlockInWorldPartially(this.mc.thePlayer.getEntityId(), this.currentBlockX, this.currentBlockY, this.currentblockZ, (int)(this.curBlockDamageMP * 10.0F) - 1);
    }
    else
    {
        clickBlock(p_78759_1_, p_78759_2_, p_78759_3_, p_78759_4_);
    }
}
项目:4Space-5    文件:PlayerControllerMP.java   
public void onStoppedUsingItem(EntityPlayer p_78766_1_)
{
    syncCurrentPlayItem();
    this.netClientHandler.addToSendQueue(new C07PacketPlayerDigging(5, 0, 0, 0, 255));
    p_78766_1_.stopUsingItem();
}
项目:Factorization    文件:FactorizationClientProxy.java   
@Override
public void sendBlockClickPacket() {
    Minecraft mc = Minecraft.getMinecraft();
    MovingObjectPosition mop = mc.objectMouseOver;
    new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.START_DESTROY_BLOCK /* NORELEASE: was 0, is this correct? This is for barrels: punch w/ empty fist so that an item goes into that fist; prevents a second click from happening. */, mop.getBlockPos(), mop.sideHit);
}