當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。