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


Java ItemDye.applyBonemeal方法代码示例

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


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

示例1: work

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
@Override
public float work() {
    if (WorkUtils.isDisabled(this.getBlockType())) return 0;
    List<BlockPos> blockPos = BlockUtils.getBlockPosInAABB(getWorkingArea());
    boolean needsToIncrease = true;
    if (pointer >= blockPos.size()) pointer = 0;
    if (pointer < blockPos.size()) {
        BlockPos pos = blockPos.get(pointer);
        if (!this.world.isAirBlock(pos)) {
            ItemStack stack = getFirstItem();
            if (!stack.isEmpty()) {
                FakePlayer player = IndustrialForegoing.getFakePlayer(this.world);
                if (ItemDye.applyBonemeal(stack, this.world, pos, player, EnumHand.MAIN_HAND))
                    needsToIncrease = false;
            }
        }
    } else {
        pointer = 0;
    }
    if (needsToIncrease) ++pointer;
    return 1;
}
 
开发者ID:Buuz135,项目名称:Industrial-Foregoing,代码行数:23,代码来源:CropEnrichMaterialInjectorTile.java

示例2: onItemUse

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
@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,代码行数:26,代码来源:ItemFertilizer.java

示例3: onItemUse

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
@Override public EnumActionResult onItemUse(ItemStack srcItemStack, EntityPlayer playerEntity, World world, BlockPos target, EnumHand hand, EnumFacing face, float par8, float par9, float par10){
	boolean canUse = ItemDye.applyBonemeal(srcItemStack,world,target,playerEntity);
	if(canUse){
		phantomBonemeal.stackSize = 27;
		for(int dx = -2; dx <= 2; dx++){
			for(int dy = -2; dy <= 2; dy++){
				for(int dz = -1; dz <= 1; dz++){
					if((dx | dy | dz) == 0) continue;
					BlockPos t = target.add(dx, dy, dz);
					ItemDye.applyBonemeal(phantomBonemeal,world,t,playerEntity);
				}
			}
		}
		return EnumActionResult.SUCCESS;
	}
	return EnumActionResult.PASS;
}
 
开发者ID:cyanobacterium,项目名称:Minecraft_Mineralogy,代码行数:18,代码来源:MineralFertilizer.java

示例4: applyEnrichment

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
public boolean applyEnrichment (ItemStack itemStack, World world, int x, int y, int z, EntityPlayer player) {
    ConfigManager config = GardenCore.config;
    Block block = world.getBlock(x, y, z);

    EnrichedSoilEvent event = new EnrichedSoilEvent(player, world, block, x, y, z);
    if (MinecraftForge.EVENT_BUS.post(event))
        return false;

    if (!config.enableCompostBonemeal)
        return false;

    if (event.getResult() == Event.Result.ALLOW) {
        if (!world.isRemote)
            itemStack.stackSize--;
        return true;
    }

    int prob = (config.compostBonemealStrength == 0) ? 0 : (int)(1 / config.compostBonemealStrength);
    if (world.rand.nextInt(prob) == 0)
        return ItemDye.applyBonemeal(itemStack, world, x, y, z, player);
    else
        --itemStack.stackSize;

    return true;
}
 
开发者ID:jaquadro,项目名称:GardenCollection,代码行数:26,代码来源:ItemCompost.java

示例5: doWork

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
private void doWork(TileEmcCapacitor emcCap)
{
    for (int x = -4; x <= 4; x++)
    {
        for (int z = -4; z <= 4; z++)
        {
            if (!(Block.blocksList[worldObj.getBlockId(xCoord + x, yCoord,
                    zCoord + z)] == Block.grass))
            {
                if (ItemDye.applyBonemeal(new ItemStack(Item.dyePowder),
                        worldObj, xCoord + x, yCoord, zCoord + z,
                        FakePlayerFactory.getMinecraft(worldObj)))
                {
                    emcCap.useEmc(new EmcValue(1.0F, EmcType.ESSENTIA),
                            xCoord, yCoord, zCoord);
                }
            }
        }
    }
}
 
开发者ID:Dynious,项目名称:EnergyFromMatter,代码行数:21,代码来源:TileCropRipener.java

示例6: run

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
@Override
public boolean run(@Nonnull SpellData spell) {
	World world = spell.world;
	BlockPos targetPos = spell.getData(BLOCK_HIT);
	Entity targetEntity = spell.getData(ENTITY_HIT);
	Entity caster = spell.getData(CASTER);
	Vec3d pos = spell.getData(TARGET_HIT);

	if (pos != null)
		spell.world.playSound(null, new BlockPos(pos), ModSounds.HEAL, SoundCategory.NEUTRAL, 1, 1);
	if (targetEntity instanceof EntityLivingBase) {
		double strength = getModifier(spell, Attributes.POTENCY, 3, 20) / 10.0;

		if (!tax(this, spell)) return false;

		((EntityLivingBase) targetEntity).heal((float) strength);
	}

	if (targetPos != null) {
		if (world.getBlockState(targetPos).getBlock() instanceof IGrowable) {
			if (!tax(this, spell)) return false;
			if (caster == null || (caster instanceof EntityPlayer && BlockUtils.hasEditPermission(targetPos, (EntityPlayerMP) caster)))
				ItemDye.applyBonemeal(new ItemStack(Items.DYE), world, targetPos);
		} else if (world.getBlockState(targetPos).getBlock() instanceof IPlantable) {
			IBlockState state = world.getBlockState(targetPos);
			Block block = state.getBlock();
			if (!tax(this, spell)) return false;
			if (caster == null || (caster instanceof EntityPlayer && BlockUtils.hasEditPermission(targetPos, (EntityPlayerMP) caster))) {
				while (world.getBlockState(targetPos.up()).getBlock() == block) {
					targetPos = targetPos.up();
					state = world.getBlockState(targetPos);
					block = state.getBlock();
				}
				world.immediateBlockTick(targetPos, state, RandUtil.random);
			}
		}
	}
	return true;
}
 
开发者ID:TeamWizardry,项目名称:Wizardry,代码行数:40,代码来源:ModuleEffectThrive.java

示例7: onBonemealUse

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
private boolean onBonemealUse( final ItemStack stack, int x, final int y, int z, final World world ) {
	for ( int a = 0; a < 3; a++ ) {
		final Block i = world.getBlock( x, y + 1, z );
		final int j = world.getBlockMetadata( x, y + 1, z );

		if ( i == Blocks.wheat && j < 7 ) {
			final Block block = Blocks.wheat;
			world.playSoundEffect( x + 0.5F, y + 0.5F, z + 0.5F, block.stepSound.getBreakSound(),
					(block.stepSound.getVolume() + 1.0F) / 2.0F, block.stepSound.getPitch() * 0.8F );

			ItemDye.applyBonemeal(stack, world, x, y, z, null);

			fairy.armSwing( !fairy.didSwing );
			fairy.setTempItem( stack.getItem() );
			fairy.attackTime = 30;

			if ( fairy.flymode() && fairy.getFlyTime() > 0 ) {
				fairy.setFlyTime( 0 );
			}

			return true;
		}

		x += fairy.getRNG().nextInt( 3 ) - 1;
		z += fairy.getRNG().nextInt( 3 ) - 1;
	}

	return false;
}
 
开发者ID:allaryin,项目名称:FairyFactions,代码行数:30,代码来源:FairyJob.java

示例8: doPlotScan

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
void doPlotScan() {

		final ItemStack meal = inventory.getStackInSlot(MEAL);
		if (meal == null)
			return;

		if (++scanTickCount % PLOT_SCAN_TICK_INTERVAL == 0) {
			scanTickCount = 0;

			final int PLOT_ANCHOR_X = xCoord - PLOT_SIZE / 2;
			final int PLOT_ANCHOR_Z = zCoord - PLOT_SIZE / 2;

			final int blockX = scanIndex % PLOT_SIZE + PLOT_ANCHOR_X;
			final int blockZ = scanIndex / PLOT_SIZE + PLOT_ANCHOR_Z;

			final Block target = worldObj.getBlock(blockX, yCoord, blockZ);

			if (bonemealTarget(target)) {

				final EntityPlayer recycling = FakePlayerHelper.getFakePlayer((WorldServer) worldObj,
								blockX, yCoord, blockZ).get();
				final boolean applied = ItemDye.applyBonemeal(meal, worldObj, blockX,
						yCoord, blockZ, recycling);

				if (applied)
					ParticleEffects.bonemeal(worldObj, blockX, yCoord, blockZ,
							null);

				if (meal.stackSize == 0)
					inventory.setInventorySlotContents(MEAL, null);
				else
					inventory.setInventorySlotContents(MEAL, meal);
			}

			if (++scanIndex == PLOT_AREA)
				scanIndex = 0;
		}
	}
 
开发者ID:OreCruncher,项目名称:ThermalRecycling,代码行数:39,代码来源:ComposterTileEntity.java

示例9: doBonemeal

import net.minecraft.item.ItemDye; //导入方法依赖的package包/类
private void doBonemeal( MovingObjectPosition mop )
{
	if ( !worldObj.isRemote && mop.entityHit == null && mop.sideHit != -1 )
	{
		int x = mop.blockX;
		int y = mop.blockY;
		int z = mop.blockZ
				;
		Block block = worldObj.getBlock( x, y, z );
		
		if ( block == farmland )
		{
			--y;
		}
		
		if ( block != null )
		{
			ItemStack bonemeal = new ItemStack( dye, 1, 15 );
			ItemDye.applyBonemeal( bonemeal, worldObj, x, y, z, null );
			
			if ( bonemeal.stackSize == 0 )
			{
				setDead();
			}
		}
	}
}
 
开发者ID:spacechase0,项目名称:ComponentEquipment,代码行数:28,代码来源:ArrowEntity.java


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