當前位置: 首頁>>代碼示例>>Java>>正文


Java Blocks.PUMPKIN屬性代碼示例

本文整理匯總了Java中net.minecraft.init.Blocks.PUMPKIN屬性的典型用法代碼示例。如果您正苦於以下問題:Java Blocks.PUMPKIN屬性的具體用法?Java Blocks.PUMPKIN怎麽用?Java Blocks.PUMPKIN使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在net.minecraft.init.Blocks的用法示例。


在下文中一共展示了Blocks.PUMPKIN屬性的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: isExcepBlockForAttachWithPiston

protected static boolean isExcepBlockForAttachWithPiston(Block p_194142_0_) {
	return Block.isExceptBlockForAttachWithPiston(p_194142_0_) || p_194142_0_ == Blocks.BARRIER || p_194142_0_ == Blocks.MELON_BLOCK || p_194142_0_ == Blocks.PUMPKIN || p_194142_0_ == Blocks.LIT_PUMPKIN;
}
 
開發者ID:Um-Mitternacht,項目名稱:Bewitchment,代碼行數:3,代碼來源:BlockScornedBrickFence.java

示例2: canPlantCrop

public static boolean canPlantCrop(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, Block cropBlock) {
	
	if (side != EnumFacing.UP)
		return false;
	
	if (!world.isRemote && cropBlock instanceof BlockCropsBase && !((BlockCropsBase)cropBlock).canPlantCrop()) {
		UCPacketHandler.sendToNearbyPlayers(world, pos, new PacketUCEffect(EnumParticleTypes.BARRIER, pos.getX(), pos.getY() + 2, pos.getZ(), 0));
		return false;
	}
	else if (player.canPlayerEdit(pos, side, stack) && player.canPlayerEdit(pos.offset(EnumFacing.UP), side, stack)) {
		IBlockState state = world.getBlockState(pos);
		if (state.getBlock().canSustainPlant(state, world, pos, EnumFacing.UP, (IPlantable)stack.getItem()) && world.isAirBlock(pos.offset(EnumFacing.UP))) {
			if (cropBlock == UCBlocks.cropCollis) {
				if (!world.provider.isSurfaceWorld() || pos.getY() <= 100)
					return false;
			}
			if (cropBlock == UCBlocks.cropCinderbella) {
				long time = world.getWorldTime() % 24000L;
				if (time >= 18000)
					return false;
				
				BlockPos pos1 = pos.add(0, 1, 0);
				int pumpkins = 0;
				for (EnumFacing facing : EnumFacing.HORIZONTALS) {
					IBlockState pumpkin = world.getBlockState(pos1.offset(facing));
					if (pumpkin.getBlock() != null && pumpkin.getBlock() == Blocks.PUMPKIN && !world.isRemote) {
						pumpkins++;
					}
				}
				if (pumpkins >= 4) {
					cropBlock.onBlockPlacedBy(world, pos.offset(side), cropBlock.getDefaultState(), player, stack);
					return true;
				}
			}
			if (cropBlock == UCBlocks.cropFeroxia) {
				cropBlock.onBlockPlacedBy(world, pos.offset(side), cropBlock.getDefaultState(), player, stack);
				return true;
			}
			if (cropBlock == UCBlocks.cropEula) {
				player.openGui(UniqueCrops.instance, 1, world, (int)player.posX, (int)player.posY, (int)player.posZ);
			}
			if (cropBlock == UCBlocks.cropAbstract) {
				player.renderBrokenItemStack(stack);
				if (!player.worldObj.isRemote)
					setAbstractCropGrowth(player, true);
				return true;
			}
			if (cropBlock == UCBlocks.cropPetramia && pos.offset(side).getY() >= 10) {
				return false;
			}
			world.setBlockState(pos.offset(side), cropBlock.getDefaultState(), 3);
			return true;
		}
	}
	return false;
}
 
開發者ID:bafomdad,項目名稱:uniquecrops,代碼行數:56,代碼來源:SeedBehavior.java

示例3: getSeedItem

@Nullable
protected Item getSeedItem()
{
    return this.crop == Blocks.PUMPKIN ? Items.PUMPKIN_SEEDS : (this.crop == Blocks.MELON_BLOCK ? Items.MELON_SEEDS : null);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:5,代碼來源:BlockStem.java

示例4: apply

public boolean apply(@Nullable IBlockState p_apply_1_)
{
    return p_apply_1_ != null && (p_apply_1_.getBlock() == Blocks.PUMPKIN || p_apply_1_.getBlock() == Blocks.LIT_PUMPKIN);
}
 
開發者ID:sudofox,項目名稱:Backmemed,代碼行數:4,代碼來源:BlockPumpkin.java


注:本文中的net.minecraft.init.Blocks.PUMPKIN屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。