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


Java EnumActionResult.SUCCESS属性代码示例

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


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

示例1: onItemUse

@Override
public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand,
		EnumFacing facing, float hitX, float hitY, float hitZ) {
	
	ItemStack stack = player.getHeldItem(hand);
	
	if (!player.canPlayerEdit(pos.offset(facing), facing, stack))
       {
           return EnumActionResult.FAIL;
           
       }else{
       	 if (ItemDye.applyBonemeal(stack, worldIn, pos, player, hand))
            {
                if (!worldIn.isRemote)
                {
                    worldIn.playEvent(2005, pos, 0);
                }

                return EnumActionResult.SUCCESS;
                
            }else{
           	 return EnumActionResult.PASS;
            }
       }
}
 
开发者ID:EnderiumSmith,项目名称:CharcoalPit,代码行数:25,代码来源:ItemFertilizer.java

示例2: onItemUse

@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    ItemStack stack = playerIn.getHeldItem(hand);
    Upgrades upgrade = Upgrades.values()[stack.getMetadata()];

    IBlockState state = world.getBlockState(pos);
    if (state.getBlock() == MoreFurnaces.blockFurnaces)
    {
        if (useOnModFurnace(playerIn, world, pos, stack, upgrade)) return EnumActionResult.SUCCESS;
    } else if (state.getBlock() == Blocks.FURNACE || state.getBlock() == Blocks.LIT_FURNACE)
    {
        if (upgrade.isVanillaUpgrade())
        {
            if (useOnVanillaFurnace(playerIn, world, pos, stack, upgrade)) return EnumActionResult.SUCCESS;
        }
    }

    return EnumActionResult.PASS;
}
 
开发者ID:cubex2,项目名称:morefurnaces,代码行数:20,代码来源:ItemUpgrade.java

示例3: onItemRightClick

public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (playerIn.fishEntity != null)
    {
        int i = playerIn.fishEntity.handleHookRetraction();
        itemStackIn.damageItem(i, playerIn);
        playerIn.swingArm(hand);
    }
    else
    {
        worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_BOBBER_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

        if (!worldIn.isRemote)
        {
            worldIn.spawnEntityInWorld(new EntityFishHook(worldIn, playerIn));
        }

        playerIn.swingArm(hand);
        playerIn.addStat(StatList.getObjectUseStats(this));
    }

    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:23,代码来源:ItemFishingRod.java

示例4: onItemRightClick

public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);
    ItemStack itemstack1 = worldIn.capabilities.isCreativeMode ? itemstack.copy() : itemstack.splitStack(1);
    itemStackIn.playSound((EntityPlayer)null, worldIn.posX, worldIn.posY, worldIn.posZ, SoundEvents.ENTITY_LINGERINGPOTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!itemStackIn.isRemote)
    {
        EntityPotion entitypotion = new EntityPotion(itemStackIn, worldIn, itemstack1);
        entitypotion.setHeadingFromThrower(worldIn, worldIn.rotationPitch, worldIn.rotationYaw, -20.0F, 0.5F, 1.0F);
        itemStackIn.spawnEntityInWorld(entitypotion);
    }

    worldIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:ItemLingeringPotion.java

示例5: onItemUse

@Override
public EnumActionResult onItemUse(EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	IBlockState state = worldIn.getBlockState(pos);
	ItemStack heldItem = playerIn.getHeldItem(hand);

	if (heldItem.isEmpty()) {
		return super.onItemUse(playerIn, worldIn, pos, hand, facing, hitX, hitY, hitZ);
	}
	if (facing == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(facing), facing, heldItem) && (state.getBlock() == net.minecraft.init.Blocks.GRASS || state.getBlock() == net.minecraft.init.Blocks.DIRT || state.getBlock() == net.minecraft.init.Blocks.SAND) && worldIn.isAirBlock(pos.up())) {
		worldIn.setBlockState(pos.up(), BlockRegistry.palm_sapling.getDefaultState());
		heldItem.shrink(1);
		return EnumActionResult.SUCCESS;
	} else {
		return EnumActionResult.FAIL;
	}
}
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:16,代码来源:ItemDates.java

示例6: onItemUse

/**
    * Called when a Block is right-clicked with this Item
    */
@Override
   public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
   {
       net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos);

       if (facing == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(facing), facing, stack) && (state.getBlock()== net.minecraft.init.Blocks.GRASS ||state.getBlock()==net.minecraft.init.Blocks.DIRT|| state.getBlock()==net.minecraft.init.Blocks.FARMLAND) && worldIn.isAirBlock(pos.up()))
       {
       	worldIn.setBlockState(pos.up(), this.getSaplingState());
           --stack.stackSize;
           return EnumActionResult.SUCCESS;
       }
       else
       {
           return EnumActionResult.FAIL;
       }
   }
 
开发者ID:MinecraftModDevelopmentMods,项目名称:Got-Wood,代码行数:19,代码来源:ItemSeed.java

示例7: onItemRightClick

@Override
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
	if (!world.isRemote) {
		IBaublesItemHandler baubles = BaublesApi.getBaublesHandler(player);
		for (int i = 0; i < baubles.getSlots(); i++)
			if (baubles.getStackInSlot(i).isEmpty() && baubles.isItemValidForSlot(i, player.getHeldItem(hand), player)) {
				baubles.setStackInSlot(i, player.getHeldItem(hand).copy());
				if (!player.capabilities.isCreativeMode) {
					player.setHeldItem(hand, ItemStack.EMPTY);
				}
				onEquipped(player.getHeldItem(hand), player);
				break;
			}
	}
	return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, player.getHeldItem(hand));
}
 
开发者ID:Um-Mitternacht,项目名称:Bewitchment,代码行数:16,代码来源:ItemTriskelionAmulet.java

示例8: onItemUse

/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    worldIn = worldIn.offset(hand);
    ItemStack itemstack = stack.getHeldItem(pos);

    if (!stack.canPlayerEdit(worldIn, hand, itemstack))
    {
        return EnumActionResult.FAIL;
    }
    else
    {
        if (playerIn.getBlockState(worldIn).getMaterial() == Material.AIR)
        {
            playerIn.playSound(stack, worldIn, SoundEvents.ITEM_FLINTANDSTEEL_USE, SoundCategory.BLOCKS, 1.0F, itemRand.nextFloat() * 0.4F + 0.8F);
            playerIn.setBlockState(worldIn, Blocks.FIRE.getDefaultState(), 11);
        }

        itemstack.damageItem(1, stack);
        return EnumActionResult.SUCCESS;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:24,代码来源:ItemFlintAndSteel.java

示例9: onItemRightClick

public ActionResult<ItemStack> onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn, EnumHand hand)
{
    if (!playerIn.capabilities.isCreativeMode)
    {
        --itemStackIn.stackSize;
    }

    worldIn.playSound((EntityPlayer)null, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ENTITY_SPLASH_POTION_THROW, SoundCategory.NEUTRAL, 0.5F, 0.4F / (itemRand.nextFloat() * 0.4F + 0.8F));

    if (!worldIn.isRemote)
    {
        EntityPotion entitypotion = new EntityPotion(worldIn, playerIn, itemStackIn);
        entitypotion.setHeadingFromThrower(playerIn, playerIn.rotationPitch, playerIn.rotationYaw, -20.0F, 0.5F, 1.0F);
        worldIn.spawnEntityInWorld(entitypotion);
    }

    playerIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemStackIn);
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:19,代码来源:ItemSplashPotion.java

示例10: onItemUse

/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
{
    net.minecraft.block.state.IBlockState state = worldIn.getBlockState(pos);
    if (facing == EnumFacing.UP && playerIn.canPlayerEdit(pos.offset(facing), facing, stack) && state.getBlock().canSustainPlant(state, worldIn, pos, EnumFacing.UP, this) && worldIn.isAirBlock(pos.up()))
    {
        worldIn.setBlockState(pos.up(), this.crops.getDefaultState(), 11);
        --stack.stackSize;
        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:17,代码来源:ItemSeedFood.java

示例11: onItemUse

@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	if (world.isRemote) {
		RebornInfoProviderHUD.addElement(new BlockDisplayElement());
	}
	if (!world.isRemote && player.isSneaking()) {
		return EnumActionResult.SUCCESS;
	}
	return EnumActionResult.PASS;
}
 
开发者ID:TechReborn,项目名称:TechReborn3,代码行数:10,代码来源:ItemWrench.java

示例12: onItemUse

/**
 * Called when a Block is right-clicked with this Item
 */
public EnumActionResult onItemUse(EntityPlayer stack, World playerIn, BlockPos worldIn, EnumHand pos, EnumFacing hand, float facing, float hitX, float hitY)
{
    ItemStack itemstack = stack.getHeldItem(pos);
    BlockPos blockpos = worldIn.offset(hand);

    if (hand != EnumFacing.DOWN && hand != EnumFacing.UP && stack.canPlayerEdit(blockpos, hand, itemstack))
    {
        EntityHanging entityhanging = this.createEntity(playerIn, blockpos, hand);

        if (entityhanging != null && entityhanging.onValidSurface())
        {
            if (!playerIn.isRemote)
            {
                entityhanging.playPlaceSound();
                playerIn.spawnEntityInWorld(entityhanging);
            }

            itemstack.func_190918_g(1);
        }

        return EnumActionResult.SUCCESS;
    }
    else
    {
        return EnumActionResult.FAIL;
    }
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:30,代码来源:ItemHangingEntity.java

示例13: onItemRightClick

@Override
public ActionResult<ItemStack> onItemRightClick(World worldIn, EntityPlayer playerIn,
		EnumHand hand) {
	ItemStack itemStackIn = playerIn.getHeldItem(hand);
	if (TF2Attribute.getModifier("Rage Crit", itemStackIn, 0, playerIn)!=0 &&playerIn.getCapability(TF2weapons.WEAPONS_CAP, null).getPhlogRage()>=20f) {
		playerIn.setActiveHand(hand);
		return new ActionResult<ItemStack>(EnumActionResult.SUCCESS, itemStackIn);
	}
	return new ActionResult<ItemStack>(EnumActionResult.FAIL, itemStackIn);
}
 
开发者ID:rafradek,项目名称:Mods,代码行数:10,代码来源:ItemFlameThrower.java

示例14: onItemRightClick

public ActionResult<ItemStack> onItemRightClick(World itemStackIn, EntityPlayer worldIn, EnumHand playerIn)
{
    ItemStack itemstack = worldIn.getHeldItem(playerIn);

    if (!itemStackIn.isRemote)
    {
        this.resolveContents(itemstack, worldIn);
    }

    worldIn.openBook(itemstack, playerIn);
    worldIn.addStat(StatList.getObjectUseStats(this));
    return new ActionResult(EnumActionResult.SUCCESS, itemstack);
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:13,代码来源:ItemWrittenBook.java

示例15: onItemRightClick

@Override
@SideOnly (Side.CLIENT)
public ActionResult<ItemStack> onItemRightClick(World world, EntityPlayer player, EnumHand hand) {
    ItemStack itemStack = player.getHeldItem(hand);
    if (world.isRemote) {
        WirelessRedstone.proxy.openPSnifferGui(player);
        RedstoneEtherAddons.client().addSniffer(player);
        return new ActionResult<>(EnumActionResult.SUCCESS, itemStack);
    }
    return new ActionResult<>(EnumActionResult.PASS, itemStack);
}
 
开发者ID:TheCBProject,项目名称:WirelessRedstone,代码行数:11,代码来源:ItemPrivateSniffer.java


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