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


Java BlockNetherWart类代码示例

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


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

示例1: onItemUse

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) {
	
	if (stack.getItemDamage() == EnumItems.TIMEMEAL.ordinal() && player.canPlayerEdit(pos, facing, stack)) {
		Block crops = world.getBlockState(pos).getBlock();
		if (crops != null && crops instanceof BlockCrops) {
			if (crops != UCBlocks.cropMerlinia)
				world.setBlockState(pos, ((BlockCrops)crops).withAge(0), 2);
			else if (crops == UCBlocks.cropMerlinia)
				((Merlinia)crops).merliniaGrowth(world, pos, world.rand.nextInt(1) + 1);
			else if (crops instanceof BlockNetherWart)
				((BlockNetherWart)crops).updateTick(world, pos, world.getBlockState(pos), world.rand);
			if (!player.capabilities.isCreativeMode && !player.worldObj.isRemote)
				stack.stackSize--;
			UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.VILLAGER_HAPPY, pos.getX() - 0.5D, pos.getY(), pos.getZ() - 0.5D, 6));
			return EnumActionResult.SUCCESS;
		}
	}
	return super.onItemUse(stack, player, world, pos, hand, facing, hitX, hitY, hitZ);
}
 
开发者ID:bafomdad,项目名称:uniquecrops,代码行数:20,代码来源:ItemGeneric.java

示例2: onItemUse

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
@Override
public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ)
   {
	ItemStack stack = player.getHeldItem(hand);
	if(ItemStackTools.isValid(stack) && stack.getMetadata() == BoneType.BONEMEAL.getMetadata()){
		IBlockState state = world.getBlockState(pos);
		if(state.getBlock() == Blocks.NETHER_WART){
			int i = state.getValue(BlockNetherWart.AGE).intValue();

	        if (i < 3 && net.minecraftforge.common.ForgeHooks.onCropsGrowPre(world, pos, state, true))
	        {
	            state = state.withProperty(BlockNetherWart.AGE, Integer.valueOf(i + 1));
	            world.setBlockState(pos, state, 2);
	            net.minecraftforge.common.ForgeHooks.onCropsGrowPost(world, pos, state, world.getBlockState(pos));
	            
	            if(!player.capabilities.isCreativeMode){
	            	player.setHeldItem(hand, ItemUtil.consumeItem(stack));
	            }		            
	            return EnumActionResult.SUCCESS;
	        }
		}
	}
	return EnumActionResult.PASS;
   }
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:25,代码来源:ItemCursedBone.java

示例3: isGrown

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
@Override
public boolean isGrown(Point3I plantPoint, Block plantBlock, IBlockState state, World worldObj) {
	int metadata = plantBlock.getMetaFromState(state);
	//check pumpkins and mellons first
	if (plantBlock instanceof BlockStem) {
		for (EnumFacing facing : EnumFacing.Plane.HORIZONTAL) {
			Block testBlock = worldObj.getBlockState(plantPoint.toPosition().offset(facing)).getBlock();
			if ( (testBlock == Blocks.MELON_BLOCK) || (testBlock == Blocks.PUMPKIN) )
				return true;
		}
	} else if (plantBlock instanceof IGrowable) {
		return !((IGrowable)plantBlock).canGrow(worldObj, plantPoint.toPosition(), state, true);
	} else if (plantBlock instanceof BlockNetherWart) { //nether wart
		return (metadata >= 3);
	} else if (plantBlock == Blocks.REEDS) { // sugar cane
		return (worldObj.getBlockState(plantPoint.toPosition().up()).getBlock() == Blocks.REEDS);
	} else if (plantBlock == Blocks.CACTUS) { //cactus
		return (worldObj.getBlockState(plantPoint.toPosition().up()).getBlock() == Blocks.CACTUS);
	}
	return false;
}
 
开发者ID:Vanhal,项目名称:ProgressiveAutomation,代码行数:22,代码来源:Vanilla.java

示例4: isGrownCrop

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
public static boolean isGrownCrop(World world, BlockPos pos)
{
	if (world.isAirBlock(pos)) {
      return false;
    }
    boolean found = false;
    IBlockState state = world.getBlockState(pos);
    Block bi = state.getBlock();
    for (int a = 0; a < 16; a++) {
      if ((getCrops(CropType.NORMAL).contains(bi.getUnlocalizedName() + a)) || (getCrops(CropType.STACKED).contains(bi.getUnlocalizedName() + a)) || (getCrops(CropType.CLICKABLE).contains(bi.getUnlocalizedName() + a)))
      {
        found = true;
        break;
      }
    }
    Block biB = world.getBlockState(pos.down()).getBlock();
    int md = bi.getMetaFromState(state);
    
    if ((((bi instanceof IGrowable)) && (!((IGrowable)bi).canGrow(world, pos, state, world.isRemote)) && (!(bi instanceof BlockStem))) 
    		|| (((bi instanceof BlockCrops)) && ((BlockCrops)bi).isMaxAge(state) && (!found)) 
    		|| ((bi == Blocks.NETHER_WART) && (state.getValue(BlockNetherWart.AGE).intValue() >= 3)) 
    		|| ((bi == Blocks.COCOA) && (state.getValue(BlockCocoa.AGE).intValue() >= 2)) 
    		|| (getCrops(CropType.NORMAL).contains(bi.getUnlocalizedName() + md)) || (getCrops(CropType.STACKED).contains(bi.getUnlocalizedName() + md)) || ((getCrops(CropType.CLICKABLE).contains(bi.getUnlocalizedName() + md)) && (biB == bi))) {
      return true;
    }
    return false;
}
 
开发者ID:Alec-WAM,项目名称:CrystalMod,代码行数:28,代码来源:FarmUtil.java

示例5: isPlant

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
@Override
public boolean isPlant(Block plantBlock, IBlockState state) {
	if (plantBlock instanceof IGrowable) return true;
	if (plantBlock instanceof BlockNetherWart) return true;
	if (plantBlock == Blocks.REEDS) return true;
	if (plantBlock == Blocks.CACTUS) return true;
	return false;
}
 
开发者ID:Vanhal,项目名称:ProgressiveAutomation,代码行数:9,代码来源:Vanilla.java

示例6: handleHarvest

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
@Override
public boolean handleHarvest(IBetterChest chest, IBlockState state, World world, BlockPos pos) {
	if (state.getValue(BlockNetherWart.AGE) == 3) {
		PlantHarvestHelper.breakBlockHandleDrop(world, pos, state, chest);
		return true;
	}
	return false;
}
 
开发者ID:Aroma1997,项目名称:BetterChests,代码行数:9,代码来源:NetherWartHandler.java

示例7: canBeHarvested

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
@Override
public boolean canBeHarvested(World world, BlockPos pos, IBlockState blockState) {
    return blockState.getBlock() instanceof BlockNetherWart && blockState.getValue(BlockNetherWart.AGE) >= 3;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:5,代码来源:BlockNetherWartRecollectable.java

示例8: canBeHarvested

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
@Override
public boolean canBeHarvested() {
    return this.state.getValue(BlockNetherWart.AGE) == 3;
}
 
开发者ID:faceofcat,项目名称:Mekfarm,代码行数:5,代码来源:VanillaNetherWartPlant.java

示例9: canHandleHarvest

import net.minecraft.block.BlockNetherWart; //导入依赖的package包/类
@Override
public boolean canHandleHarvest(IBlockState state, World world, BlockPos pos) {
	return state.getPropertyKeys().contains(BlockNetherWart.AGE);
}
 
开发者ID:Aroma1997,项目名称:BetterChests,代码行数:5,代码来源:NetherWartHandler.java


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