当前位置: 首页>>代码示例>>Java>>正文


Java CPacketPlayerDigging类代码示例

本文整理汇总了Java中net.minecraft.network.play.client.CPacketPlayerDigging的典型用法代码示例。如果您正苦于以下问题:Java CPacketPlayerDigging类的具体用法?Java CPacketPlayerDigging怎么用?Java CPacketPlayerDigging使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


CPacketPlayerDigging类属于net.minecraft.network.play.client包,在下文中一共展示了CPacketPlayerDigging类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: dissectPacket

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
public void dissectPacket(Object msg) {
	if (!(msg instanceof CPacketPlayerDigging)) {
		return;
	}
	CPacketPlayerDigging packet = (CPacketPlayerDigging) msg;
	if (packet.getAction() != CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK) {
		// even though the name may suggest otherwise, STOP_DESTROY_BLOCK means the player successfully broke the block
		return;
	}
	// at this point we have confirmed that some kind of block was broken, so we check what kind. We can use forge
	// events for just any kind of interaction in general, but not for block breaks specificially, so we pull the item
	// the player used to mine and the block he mined from the interact event
	if (OreLogger.instance.getListener().getCachedMaterial() == Material.ROCK
			&& OreLogger.instance.getListener().getCachedVariant() == 0) {
		// confirmed stone break
		sbCounter.breakOccured(OreLogger.instance.getListener().getCachedBlockPos());
	}

}
 
开发者ID:Maxopoly,项目名称:OreLogger,代码行数:20,代码来源:BlockBreakHandler.java

示例2: breakBlockPacketSpam

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
public static void breakBlockPacketSpam(BlockPos pos)
{
	Vec3d eyesPos = RotationUtils.getEyesPos();
	Vec3d posVec = new Vec3d(pos).addVector(0.5, 0.5, 0.5);
	double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);
	
	for(EnumFacing side : EnumFacing.values())
	{
		Vec3d hitVec =
			posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5));
		
		// check if side is facing towards player
		if(eyesPos.squareDistanceTo(hitVec) >= distanceSqPosVec)
			continue;
		
		// break block
		WConnection.sendPacket(new CPacketPlayerDigging(
			Action.START_DESTROY_BLOCK, pos, side));
		WConnection.sendPacket(
			new CPacketPlayerDigging(Action.STOP_DESTROY_BLOCK, pos, side));
		
		return;
	}
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:25,代码来源:BlockUtils.java

示例3: onUpdate

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
@Override
public void onUpdate() {
	if(mc.thePlayer.capabilities.isCreativeMode){
		for(int x = -size; x < size + sizeOther; x++){
			for(int z = -size; z < size + sizeOther; z++){
				for(int y = -size; y < size + sizeOther; y++){
					boolean shouldBreakBlock = true;
        			int blockX = (int) (mc.thePlayer.posX + x);
        			int blockY = (int) (mc.thePlayer.posY + y);
        			int blockZ = (int) (mc.thePlayer.posZ + z);
        			if (Block.getIdFromBlock(mc.theWorld.getBlockState(new BlockPos(blockX, blockY, blockZ)).getBlock()) != 0){
        				mc.thePlayer.sendQueue.addToSendQueue(new CPacketPlayerDigging(CPacketPlayerDigging.Action.START_DESTROY_BLOCK, new BlockPos(blockX, blockY, blockZ), EnumFacing.UP));
         			}
 				}
 			}
 		}
	}
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:19,代码来源:Nuker.java

示例4: onUpdate

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
@Override
public void onUpdate() {
	BlockPos var1 = mc.objectMouseOver.getBlockPos();

	if (mc.theWorld.getBlockState(var1).getMaterial() == Material.air)
		return;
	if (mc.playerController.isHittingBlock)
		if (ncp
				&& mc.gameSettings.keyBindAttack.isKeyDown())
			PacketUtils.sendPacket(new CPacketPlayerDigging(Action.STOP_DESTROY_BLOCK,
					mc.objectMouseOver.getBlockPos(), EnumFacing.getHorizontal(-1)));
		else {
			PacketUtils.sendPacket(new CPacketPlayerDigging(Action.START_DESTROY_BLOCK,
					mc.objectMouseOver.getBlockPos(), EnumFacing.getHorizontal(-1)));
			PacketUtils.sendPacket(new CPacketPlayerDigging(Action.STOP_DESTROY_BLOCK,
					mc.objectMouseOver.getBlockPos(), EnumFacing.getHorizontal(-1)));
		}
}
 
开发者ID:CheataClient,项目名称:CheataClientSrc,代码行数:19,代码来源:InstantMine.java

示例5: breakBlocksPacketSpam

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
public static void breakBlocksPacketSpam(Iterable<BlockPos> blocks)
{
	Vec3d eyesPos = RotationUtils.getEyesPos();
	
	for(BlockPos pos : blocks)
	{
		Vec3d posVec = new Vec3d(pos).addVector(0.5, 0.5, 0.5);
		double distanceSqPosVec = eyesPos.squareDistanceTo(posVec);
		
		for(EnumFacing side : EnumFacing.values())
		{
			Vec3d hitVec =
				posVec.add(new Vec3d(side.getDirectionVec()).scale(0.5));
			
			// check if side is facing towards player
			if(eyesPos.squareDistanceTo(hitVec) >= distanceSqPosVec)
				continue;
			
			// break block
			WConnection.sendPacket(new CPacketPlayerDigging(
				Action.START_DESTROY_BLOCK, pos, side));
			WConnection.sendPacket(new CPacketPlayerDigging(
				Action.STOP_DESTROY_BLOCK, pos, side));
			
			break;
		}
	}
}
 
开发者ID:Wurst-Imperium,项目名称:Wurst-MC-1.12,代码行数:29,代码来源:BlockUtils.java

示例6: dropItem

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
@Nullable

    /**
     * Drop one item out of the currently selected stack if {@code dropAll} is false. If {@code dropItem} is true the
     * entire stack is dropped.
     */
    public EntityItem dropItem(boolean dropAll)
    {
        CPacketPlayerDigging.Action cpacketplayerdigging$action = dropAll ? CPacketPlayerDigging.Action.DROP_ALL_ITEMS : CPacketPlayerDigging.Action.DROP_ITEM;
        this.connection.sendPacket(new CPacketPlayerDigging(cpacketplayerdigging$action, BlockPos.ORIGIN, EnumFacing.DOWN));
        return null;
    }
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:13,代码来源:EntityPlayerSP.java

示例7: resetBlockRemoving

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
/**
 * Resets current block damage and isHittingBlock
 */
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, EnumFacing.DOWN));
        //-ZMod-----------------------------------------------------------
        ZHandle.handle("afterBlockDig");
        //----------------------------------------------------------------
        this.isHittingBlock = false;
        this.curBlockDamageMP = 0.0F;
        this.mc.world.sendBlockBreakProgress(this.mc.player.getEntityId(), this.currentBlock, -1);
        this.mc.player.resetCooldown();
    }
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:18,代码来源:PlayerControllerMP.java

示例8: getAction

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
public static CPacketPlayerDigging.Action getAction(IDigAction action) {
	if (action.equals(IDigAction.START_DESTROY_BLOCK)) {
		return CPacketPlayerDigging.Action.START_DESTROY_BLOCK;
	} else if (action.equals(IDigAction.STOP_DESTROY_BLOCK)) {
		return CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK;
	}
	return null;
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:9,代码来源:ICPacketDig.java

示例9: resetBlockRemoving

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
/**
 * Resets current block damage and isHittingBlock
 */
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, this.currentBlock, EnumFacing.DOWN));
        this.isHittingBlock = false;
        this.curBlockDamageMP = 0.0F;
        this.mc.world.sendBlockBreakProgress(this.mc.player.getEntityId(), this.currentBlock, -1);
        this.mc.player.resetCooldown();
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:15,代码来源:PlayerControllerMP.java

示例10: dropItem

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
/**
 * Drop one item out of the currently selected stack if {@code dropAll} is false. If {@code dropItem} is true the
 * entire stack is dropped.
 */
@Nullable
public EntityItem dropItem(boolean dropAll)
{
    CPacketPlayerDigging.Action cpacketplayerdigging$action = dropAll ? CPacketPlayerDigging.Action.DROP_ALL_ITEMS : CPacketPlayerDigging.Action.DROP_ITEM;
    this.connection.sendPacket(new CPacketPlayerDigging(cpacketplayerdigging$action, BlockPos.ORIGIN, EnumFacing.DOWN));
    return null;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:12,代码来源:EntityPlayerSP.java

示例11: resetBlockRemoving

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
/**
 * Resets current block damage and field_78778_j
 */
public void resetBlockRemoving()
{
    if (this.isHittingBlock)
    {
        this.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.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);
        this.mc.thePlayer.resetCooldown();
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:15,代码来源:PlayerControllerMP.java

示例12: MessageSettlerDigging

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
public MessageSettlerDigging(EntitySettler settler, CPacketPlayerDigging.Action action, EnumFacing face, BlockPos pos) {
    this();
    this.settler = settler;
    this.action = action;
    this.face = face;
    this.pos = pos;
}
 
开发者ID:InfinityRaider,项目名称:SettlerCraft,代码行数:8,代码来源:MessageSettlerDigging.java

示例13: leftClickBlock

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
public boolean leftClickBlock(BlockPos pos, EnumFacing side, Vec3d hit) {
    if (!this.getSettler().getWorld().getWorldBorder().contains(pos)
            || SettlerCraft.instance.getMinecraftServer().isBlockProtected(this.getWorld(), pos, this.getFakePlayer())) {
        return true;
    } else {
        if (!this.isHittingBlock || !this.isHittingPosition(pos)) {
            if (this.isHittingBlock) {
                new MessageSettlerDigging(this.getSettler(), CPacketPlayerDigging.Action.ABORT_DESTROY_BLOCK, side, this.currentBlock).sendToAll();
            }
            new MessageSettlerDigging(this.getSettler(), CPacketPlayerDigging.Action.START_DESTROY_BLOCK, side, pos).sendToAll();
            PlayerInteractEvent.LeftClickBlock event = ForgeHooks.onLeftClickBlock(this.getFakePlayer(), pos, side, hit);
            IBlockState state = this.getWorld().getBlockState(pos);
            boolean flag = state.getMaterial() != Material.AIR;
            if (flag && this.curBlockDamageMP == 0.0F) {
                if (event.getUseBlock() != Event.Result.DENY)
                    state.getBlock().onBlockClicked(this.getWorld(), pos, this.getFakePlayer());
            }
            if (event.getUseItem() == Event.Result.DENY) return true;
            if (flag && state.getPlayerRelativeBlockHardness(this.getFakePlayer(), this.getWorld(), pos) >= 1.0F) {
                this.onPlayerDestroyBlock();
            } else {
                this.isHittingBlock = true;
                this.currentBlock = pos;
                this.currentItemHittingBlock = this.getSettler().getHeldItemMainhand();
                this.curBlockDamageMP = 0.0F;
                //this.stepSoundTickCounter = 0.0F;
                this.getWorld().sendBlockBreakProgress(this.getSettler().getEntityId(), this.currentBlock, (int)(this.curBlockDamageMP * 10.0F) - 1);
            }
        }
        return true;
    }
}
 
开发者ID:InfinityRaider,项目名称:SettlerCraft,代码行数:33,代码来源:SettlerInteractionController.java

示例14: onStoppedUsingItem

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
public void onStoppedUsingItem(EntityPlayer playerIn)
{
    this.syncCurrentPlayItem();
    this.connection.sendPacket(new CPacketPlayerDigging(CPacketPlayerDigging.Action.RELEASE_USE_ITEM, BlockPos.ORIGIN, EnumFacing.DOWN));
    playerIn.stopActiveHand();
}
 
开发者ID:NSExceptional,项目名称:Zombe-Modpack,代码行数:7,代码来源:PlayerControllerMP.java

示例15: swapHands

import net.minecraft.network.play.client.CPacketPlayerDigging; //导入依赖的package包/类
public static void swapHands() {
	Minecraft.getMinecraft().player.connection.sendPacket(new CPacketPlayerDigging(
			CPacketPlayerDigging.Action.SWAP_HELD_ITEMS, BlockPos.ORIGIN, EnumFacing.DOWN));
}
 
开发者ID:Moudoux,项目名称:EMC,代码行数:5,代码来源:IInventory.java


注:本文中的net.minecraft.network.play.client.CPacketPlayerDigging类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。