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


Java EntityPlayerSP.isSneaking方法代码示例

本文整理汇总了Java中net.minecraft.client.entity.EntityPlayerSP.isSneaking方法的典型用法代码示例。如果您正苦于以下问题:Java EntityPlayerSP.isSneaking方法的具体用法?Java EntityPlayerSP.isSneaking怎么用?Java EntityPlayerSP.isSneaking使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.client.entity.EntityPlayerSP的用法示例。


在下文中一共展示了EntityPlayerSP.isSneaking方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onMouseEvent

import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
@SubscribeEvent
public void onMouseEvent(MouseEvent event) {
    EntityPlayerSP player = Minecraft.getMinecraft().player;
    if(event.getDwheel() != 0 && player != null && player.isSneaking()) {
        ItemStack stack = player.getHeldItemMainhand();
        Item item = stack.getItem();
        if(item instanceof ItemTransporter) {
            if(((ItemTransporter) item).getMode(stack) == 1) {

                ItemTransporter.cycleSelected(stack, event.getDwheel());
                PacketWhoosh.sendCycleSelectedPacketToServer(event.getDwheel());
                event.setCanceled(true);
            }
        }
    }
}
 
开发者ID:ImbaKnugel,项目名称:Whoosh,代码行数:17,代码来源:EventHandlerClient.java

示例2: onUpdate

import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
@Override
public void onUpdate(EntityPlayerSP player) {
	if(isEnabled() && !Hacks.findMod(Freecam.class).isEnabled()) {
		if (isInWater(player) && !player.isSneaking()) {
			player.motionY = 0.1;
			if(player.ridingEntity != null) {
				player.ridingEntity.motionY = 0.2;
			}
		}
	}
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:Jesus.java

示例3: onUpdate

import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
@Override
public void onUpdate(EntityPlayerSP entity) {
	if(isEnabled())
	{
		boolean shouldSprint = entity.movementInput.moveForward > 0.0F && !entity.isSneaking();
		if (shouldSprint) 
		{
			entity.setSprinting(true);
		}
	}
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:12,代码来源:Sprint.java

示例4: onPlayerRightClick

import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
public boolean onPlayerRightClick(EntityPlayerSP player, WorldClient worldIn, ItemStack heldStack, BlockPos hitPos, EnumFacing side, Vec3 hitVec)
{
    this.syncCurrentPlayItem();
    float f = (float)(hitVec.xCoord - (double)hitPos.getX());
    float f1 = (float)(hitVec.yCoord - (double)hitPos.getY());
    float f2 = (float)(hitVec.zCoord - (double)hitPos.getZ());
    boolean flag = false;

    if (!this.mc.theWorld.getWorldBorder().contains(hitPos))
    {
        return false;
    }
    else
    {
        if (this.currentGameType != WorldSettings.GameType.SPECTATOR)
        {
            IBlockState iblockstate = worldIn.getBlockState(hitPos);

            if ((!player.isSneaking() || player.getHeldItem() == null) && iblockstate.getBlock().onBlockActivated(worldIn, hitPos, iblockstate, player, side, f, f1, f2))
            {
                flag = true;
            }

            if (!flag && heldStack != null && heldStack.getItem() instanceof ItemBlock)
            {
                ItemBlock itemblock = (ItemBlock)heldStack.getItem();

                if (!itemblock.canPlaceBlockOnSide(worldIn, hitPos, side, player, heldStack))
                {
                    return false;
                }
            }
        }

        this.netClientHandler.addToSendQueue(new C08PacketPlayerBlockPlacement(hitPos, side.getIndex(), player.inventory.getCurrentItem(), f, f1, f2));

        if (!flag && this.currentGameType != WorldSettings.GameType.SPECTATOR)
        {
            if (heldStack == null)
            {
                return false;
            }
            else if (this.currentGameType.isCreative())
            {
                int i = heldStack.getMetadata();
                int j = heldStack.stackSize;
                boolean flag1 = heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
                heldStack.setItemDamage(i);
                heldStack.stackSize = j;
                return flag1;
            }
            else
            {
                return heldStack.onItemUse(player, worldIn, hitPos, side, f, f1, f2);
            }
        }
        else
        {
            return true;
        }
    }
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:63,代码来源:PlayerControllerMP.java

示例5: processRightClickBlock

import net.minecraft.client.entity.EntityPlayerSP; //导入方法依赖的package包/类
public EnumActionResult processRightClickBlock(EntityPlayerSP player, WorldClient worldIn, BlockPos stack, EnumFacing pos, Vec3d facing, EnumHand vec)
{
    this.syncCurrentPlayItem();
    ItemStack itemstack = player.getHeldItem(vec);
    float f = (float)(facing.xCoord - (double)stack.getX());
    float f1 = (float)(facing.yCoord - (double)stack.getY());
    float f2 = (float)(facing.zCoord - (double)stack.getZ());
    boolean flag = false;

    if (!this.mc.world.getWorldBorder().contains(stack))
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        if (this.currentGameType != GameType.SPECTATOR)
        {
            IBlockState iblockstate = worldIn.getBlockState(stack);

            if ((!player.isSneaking() || player.getHeldItemMainhand().func_190926_b() && player.getHeldItemOffhand().func_190926_b()) && iblockstate.getBlock().onBlockActivated(worldIn, stack, iblockstate, player, vec, pos, f, f1, f2))
            {
                flag = true;
            }

            if (!flag && itemstack.getItem() instanceof ItemBlock)
            {
                ItemBlock itemblock = (ItemBlock)itemstack.getItem();

                if (!itemblock.canPlaceBlockOnSide(worldIn, stack, pos, player, itemstack))
                {
                    return EnumActionResult.FAIL;
                }
            }
        }

        this.connection.sendPacket(new CPacketPlayerTryUseItemOnBlock(stack, pos, vec, f, f1, f2));

        if (!flag && this.currentGameType != GameType.SPECTATOR)
        {
            if (itemstack.func_190926_b())
            {
                return EnumActionResult.PASS;
            }
            else if (player.getCooldownTracker().hasCooldown(itemstack.getItem()))
            {
                return EnumActionResult.PASS;
            }
            else
            {
                if (itemstack.getItem() instanceof ItemBlock && !player.canUseCommandBlock())
                {
                    Block block = ((ItemBlock)itemstack.getItem()).getBlock();

                    if (block instanceof BlockCommandBlock || block instanceof BlockStructure)
                    {
                        return EnumActionResult.FAIL;
                    }
                }

                if (this.currentGameType.isCreative())
                {
                    int i = itemstack.getMetadata();
                    int j = itemstack.func_190916_E();
                    EnumActionResult enumactionresult = itemstack.onItemUse(player, worldIn, stack, vec, pos, f, f1, f2);
                    itemstack.setItemDamage(i);
                    itemstack.func_190920_e(j);
                    return enumactionresult;
                }
                else
                {
                    return itemstack.onItemUse(player, worldIn, stack, vec, pos, f, f1, f2);
                }
            }
        }
        else
        {
            return EnumActionResult.SUCCESS;
        }
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:81,代码来源:PlayerControllerMP.java


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