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


Java EntityPlayer.isSneaking方法代码示例

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


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

示例1: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	if (!(player.getHeldItemMainhand() != null
			&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
			&& (this.getOwner() == player || this.getAttackTarget() == null || this.friendly) && this.isEntityAlive() && !this.isTrading()
			&& !this.isChild() && !player.isSneaking()) {
		if (this.world.isRemote && player.getTeam() == null
				&& ((this.getCapability(TF2weapons.WEAPONS_CAP, null).state & 1) == 0 || this.friendly)
				&& !player.isCreative())
			ClientProxy.displayScreenConfirm("Choose a team to interact",
					"Visit the Mann Co. Store located in a village");
		if (!this.world.isRemote && (TF2Util.isOnSameTeam(this, player) || player.isCreative())
				&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
			this.setCustomer(player);
			FMLNetworkHandler.openGui(player, TF2weapons.instance, 4, world, this.getEntityId(), 0, 0);
		}

		player.addStat(StatList.TALKED_TO_VILLAGER);
		return true;
	} else
		return super.processInteract(player, hand);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:23,代码来源:EntityTF2Character.java

示例2: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand,
		EnumFacing facing, float hitX, float hitY, float hitZ)
{
	if (!player.isSneaking())
	{
		if (world.isRemote)
		{
			return true;
		}
		TileEntity te = world.getTileEntity(pos);
		if (!(te instanceof TileEntityInfusionAltar))
		{
			return false;
		}
		player.openGui(ArcaneMagic.instance, GUI_ID, world, pos.getX(), pos.getY(), pos.getZ());
		return true;
	}
	return false;
}
 
开发者ID:raphydaphy,项目名称:ArcaneMagic,代码行数:21,代码来源:BlockInfusionAltar.java

示例3: processInteract

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean processInteract(EntityPlayer player, EnumHand hand) {
	if (!(player.getHeldItemMainhand() != null
			&& player.getHeldItemMainhand().getItem() instanceof ItemMonsterPlacerPlus)
			&& this.getAttackTarget() == null && this.isEntityAlive() && !this.isTrading() && !this.isChild()
			&& !player.isSneaking()) {
		if (this.world.isRemote && player.getTeam() == null && !player.isCreative())
			ClientProxy.displayScreenJoinTeam();
		else if (!this.world.isRemote && (player.getTeam() != null || player.isCreative())
				&& (this.tradeOffers == null || !this.tradeOffers.isEmpty())) {
			this.setCustomer(player);
			player.displayVillagerTradeGui(this);
		}

		player.addStat(StatList.TALKED_TO_VILLAGER);
		return true;
	} else
		return super.processInteract(player, hand);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:20,代码来源:EntitySaxtonHale.java

示例4: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
	if (world.isRemote) { return stack; }								// Not doing this on client side
	if (this.getDamage(stack) >= this.getMaxDamage()) { return stack; }	// Is empty

	if (player.isSneaking())	// Dropping the magazine
	{
		this.dropMagazine(world, stack, player);
		return stack;
	}

	if (this.getDamage(stack) >= this.getMaxDamage() - 7) { return stack; }	// Doesn't have enough ammo in it)

	this.doSingleFire(stack, world, player);	// Handing it over to the neutral firing function
	return stack;
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:18,代码来源:ProximityNeedler.java

示例5: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
	//player.setItemInUse(stack, 60);	// Let's try that on both sides...

	if (world.isRemote) { return stack; }								// Not doing this on client side
	if (this.getDamage(stack) >= this.getMaxDamage()) { return stack; }	// Is empty

	if (player.isSneaking())	// Dropping the magazine
	{
		this.dropMagazine(world, stack, player);
		return stack;
	}

	this.doSingleFire(stack, world, player);	// Handing it over to the neutral firing function
	return stack;
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:18,代码来源:CoinTosser.java

示例6: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos,
		IBlockState state, EntityPlayer player, EnumFacing side, float hitX,
		float hitY, float hitZ) 
{
   if (!world.isRemote){
		if(player.isSneaking())
   		player.openGui(FundamentalChemistry.instance, ForgeGuiHandler.CHEMICAL_STORAGE, world, pos.getX(), pos.getY(), pos.getZ());
		else
			player.openGui(FundamentalChemistry.instance, ForgeGuiHandler.SIMPLE_MACHINE, world, pos.getX(), pos.getY(), pos.getZ());
   }
	
	return true;
}
 
开发者ID:ImagicTheCat,项目名称:FundamentalChemistry,代码行数:15,代码来源:BlockMoleculeAssembler.java

示例7: onItemUseFirst

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public EnumActionResult onItemUseFirst(EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
    ItemStack stack = player.getHeldItem(hand);
    if (!world.isRemote && stack.getMaxDamage() - stack.getItemDamage() >= 100) {
        List<ISemiBlock> semiBlocks = SemiBlockManager.getInstance(world).getSemiBlocksAsList(world, pos);
        
        if(semiBlocks.isEmpty()){
            pos = pos.offset(side);
            semiBlocks = SemiBlockManager.getInstance(world).getSemiBlocksAsList(world, pos);
        }

        if (!semiBlocks.isEmpty()) {
            if (player.isSneaking()) {
                semiBlocks.forEach(s -> SemiBlockManager.getInstance(world).breakSemiBlock(s, player));
                return EnumActionResult.SUCCESS;
            } else {
                //TODO raytrace?
                if (semiBlocks.stream().anyMatch(s -> s.onRightClickWithConfigurator(player))) {
                    addAir(stack, -PneumaticValues.USAGE_LOGISTICS_CONFIGURATOR);
                    return EnumActionResult.SUCCESS;
                }
            }
        }
    } else if (world.isRemote) {
        return EnumActionResult.SUCCESS;
    }
    return EnumActionResult.PASS;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:29,代码来源:ItemLogisticsConfigurator.java

示例8: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
    // right-click air: clear any camo
    ItemStack stack = playerIn.getHeldItem(handIn);
    if (!worldIn.isRemote && playerIn.isSneaking() && getCamoState(stack) != null) {
        setCamoState(stack, null);
    }
    return ActionResult.newResult(EnumActionResult.SUCCESS, stack);
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:10,代码来源:ItemCamoApplicator.java

示例9: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int metadata, float clickX, float clickY, float clickZ) {
	TileEntity tileEntity = world.getTileEntity(x, y, z);
	if (tileEntity == null || player.isSneaking()) {
		return false;
	}
	player.openGui(OpenSensors.instance, 0, world, x, y, z);
	return true;
}
 
开发者ID:PC-Logix,项目名称:OpenSensors,代码行数:10,代码来源:BlockSensor.java

示例10: rotateBlock

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean rotateBlock(World world, EntityPlayer player, BlockPos pos, EnumFacing side) {
    if (player.isSneaking()) {
        if (!player.capabilities.isCreativeMode) dropBlockAsItem(world, pos, world.getBlockState(pos), 0);
        world.setBlockToAir(pos);
        return true;
    } else {
        if (isRotatable()) {
            IBlockState state = world.getBlockState(pos);
            if (!rotateCustom(world, pos, state, side)) {
                if (rotateForgeWay()) {
                    if (!canRotateToTopOrBottom()) side = EnumFacing.UP;
                    if (getRotation(world, pos).getAxis() != side.getAxis()) {
                        setRotation(world, pos, getRotation(world, pos).rotateAround(side.getAxis()));
                    }
                } else {
                    EnumFacing f = getRotation(world, pos);
                    do {
                        f = EnumFacing.getFront(f.ordinal() + 1);
                    } while (!canRotateToTopOrBottom() && f.getAxis() == Axis.Y);
                    setRotation(world, pos, f);
                }
                TileEntityBase te = (TileEntityBase) world.getTileEntity(pos);
                if (te != null) te.onBlockRotated();
            }
            return true;
        } else {
            return false;
        }
    }
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:32,代码来源:BlockPneumaticCraft.java

示例11: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) 
   {  
	if (world.isRemote) { return stack; }				// Not doing this on client side
	if (stack.getItemDamage() == 0) { return stack; }	// Already fully loaded
	
	if (player.isSneaking())
	{
		this.fillEight(stack, world, player);
		return stack;
	}
	// else, not sneaking, so just filling one
	
	boolean doSFX = false;
	
	if (player.inventory.hasItem(Items.redstone))
	{
		int dmg = stack.getItemDamage() - 1;
		stack.setItemDamage(dmg);
		
		player.inventory.consumeInventoryItem(Items.redstone);	// We're just grabbing what we need from the inventory
		
		// SFX
		doSFX = true;
	}
	// else, doesn't have what it takes
	
	if (doSFX) { world.playSoundAtEntity(player, "random.wood_click", 0.5F, 0.3F); }
	
	return stack;
   }
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:32,代码来源:LargeRedstoneMagazine.java

示例12: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
    if (world.isRemote && player.getHeldItem(hand).isEmpty() && !player.isSneaking()) {
        player.openGui(PneumaticCraftRepressurized.instance, EnumGuiId.APHORISM_TILE.ordinal(), world, pos.getX(), pos.getY(), pos.getZ());
        sendEditorMessage(player);
    }
    return true;
}
 
开发者ID:TeamPneumatic,项目名称:pnc-repressurized,代码行数:9,代码来源:BlockAphorismTile.java

示例13: onBlockActivated

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {

	if (!world.isRemote) {

		ItemStack held = player.getHeldItem(hand);

		if (player.isSneaking()) {

			if (state.getValue(FILTER) && ((TileDisplacer) world.getTileEntity(pos)).hasFilter()) {
				state = state.withProperty(FILTER, false);
				world.setBlockState(pos, state);

				if (world.getTileEntity(pos) != null && world.getTileEntity(pos) instanceof TileDisplacer) {
					((TileDisplacer) world.getTileEntity(pos)).setHasFilter(false);
					((TileDisplacer) world.getTileEntity(pos)).markDirty();

					PacketHandler.sendToAll(new PacketDisplacerSync(((TileDisplacer) world.getTileEntity(pos)), false));
					if (!player.isCreative())
						InventoryHelper.spawnItemStack(world, pos.getX(), pos.getY(), pos.getZ(), new ItemStack(SimpleTubes.proxy.itemUpgrade, 1, 0));
				}
			}
			return true;
		} else {
			if (!(held.getItem() instanceof ItemUpgrade) || held == ItemStack.EMPTY) {
				if (((TileDisplacer) world.getTileEntity(pos)).hasFilter()) {
					player.openGui(SimpleTubes.instance, 0, world, pos.getX(), pos.getY(), pos.getZ());
					return true;
				}
			}
		}
	}

	return true;
}
 
开发者ID:oMilkyy,项目名称:SimpleTubes,代码行数:36,代码来源:BlockDisplacer.java

示例14: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player)
{
	if (world.isRemote) { return stack; }								// Not doing this on client side
	if (this.getDamage(stack) >= this.getMaxDamage()) { return stack; }	// Is empty

	if (player.isSneaking())	// Dropping the magazine
	{
		this.dropMagazine(world, stack, player);
		return stack;
	}

	this.doSingleFire(stack, world, player);	// Handing it over to the neutral firing function
	return stack;
}
 
开发者ID:Domochevsky,项目名称:minecraft-quiverbow,代码行数:16,代码来源:SugarEngine.java

示例15: onItemRightClick

import net.minecraft.entity.player.EntityPlayer; //导入方法依赖的package包/类
@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) {
	if (playerIn.isSneaking()) {
		ItemStack stack = playerIn.getHeldItem(handIn);
		if (!stack.hasTagCompound())
			stack.setTagCompound(new NBTTagCompound());
		stack.getTagCompound().setString("read_id", EntityPlayer.getUUID(playerIn.getGameProfile()).toString());
		stack.getTagCompound().setString("read_name", playerIn.getDisplayNameString());
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, stack);
	}
	return super.onItemRightClick(worldIn, playerIn, handIn);
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:13,代码来源:ItemTarots.java


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